Get A Quote Button For Woocommerce Shortcodes

Below, you’ll find a detailed guide on how to add the Get A Quote Button For Woocommerce Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Get A Quote Button For Woocommerce Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Get A Quote Button For Woocommerce Plugin and the shortcodes it provides:

Plugin Icon
Request a Quote for WooCommerce and Elementor – Get a Quote Button – Product Enquiry Form Popup – Product Quotation

"Request a Quote for WooCommerce and Elementor is a versatile plugin that provides a 'Get a Quote' button and a product inquiry form popup. It's ideal for generating product quotations."

★★★★★ (14) Active Installs: 4000+ Tested with: 6.2.3 PHP Version: false
Included Shortcodes:
  • []
  • [wpb-quote-button-hook]

Get A Quote Button For Woocommerce [wpb-quote-button] Shortcode

The ‘get-a-quote-button-for-woocommerce’ plugin shortcode initiates a contact form button. The shortcode: [wpb-quote-button] is used to call this function. This function captures and stores the output of the contact form button, appending it to any existing content. This allows the button to be placed within the content, offering users a seamless experience.

Shortcode: [wpb-quote-button]

Examples and Usage

Basic example – A simple usage of the shortcode to display the quote button without any additional parameters.

[wpb-quote-button /]

Advanced examples

Utilizing the shortcode to display the quote button with a custom ID. This will allow for unique styling or functionality to be applied to this specific button.

[wpb-quote-button id="custom-id" /]

Adding a CSS class to the quote button via the shortcode. This allows for custom styling to be applied directly from your site’s CSS.

[wpb-quote-button class="custom-class" /]

Incorporating multiple parameters into the shortcode. In this example, both an ID and a class are added. This gives you the flexibility to apply unique functionality and styling to the button.

[wpb-quote-button id="custom-id" class="custom-class" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [null] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'wpb-quote-button', array( $this, 'contact_form_button_shortcode' ) );

Shortcode PHP function:

function contact_form_button_shortcode( $atts, $content = '' ) {

        ob_start();
        self::contact_form_button( $atts );
        $content .= ob_get_clean();

        return $content;
    }

Code file location:

get-a-quote-button-for-woocommerce/get-a-quote-button-for-woocommerce/includes/class-shortcode.php

Get A Quote Button For Woocommerce [wpb-quote-button-hook] Shortcode

The ‘wpb-quote-button-hook’ shortcode is part of the get-a-quote-button-for-woocommerce plugin. It triggers the contact form button hook function, which checks for the existence of the product. If the product exists, it initiates the ‘wpb_gqb_custom_wc_hook’ action and appends its output to the content. It also ensures the Contact Form 7 scripts and styles are enqueued.

Shortcode: [wpb-quote-button-hook]

Examples and Usage

Basic example – A simple usage of the shortcode to add a quote button to a WooCommerce product page.

[wpb-quote-button-hook /]

Advanced examples

Utilizing the shortcode to add a quote button to a specific WooCommerce product by passing the product ID as an attribute. The quote button will only display on the product page of the specified ID.

[wpb-quote-button-hook id="123" /]

Using the shortcode to add a quote button to a WooCommerce product page and also specify a custom CSS class for the button. This allows for further customization of the button’s appearance through CSS.

[wpb-quote-button-hook class="custom-css-class" /]

Please note, the shortcode examples provided above will only work if the ‘wpb-quote-button-hook’ shortcode has been properly registered and the related PHP function ‘contact_form_button_hook’ has been defined in your theme’s functions.php file or within a custom plugin.

PHP Function Code

In case you have difficulties debugging what causing issues with [wpb-quote-button-hook] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'wpb-quote-button-hook', array( $this, 'contact_form_button_hook' ) );

Shortcode PHP function:

function contact_form_button_hook( $atts, $content = '' ) {
        global $product;

        if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
            wpcf7_enqueue_scripts();
        }
         
        if ( function_exists( 'wpcf7_enqueue_styles' ) ) {
            wpcf7_enqueue_styles();
        }

        if( isset($product) ){
            ob_start();
            echo do_action( 'wpb_gqb_custom_wc_hook' );
            $content .= ob_get_clean();

            return $content;
        }
    }

Code file location:

get-a-quote-button-for-woocommerce/get-a-quote-button-for-woocommerce/includes/class-shortcode.php

Conclusion

Now that you’ve learned how to embed the Get A Quote Button For Woocommerce Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *