Support » Plugin: Get a Quote Button for WooCommerce - Showing The Contact Form 7 Popup on Button Click » Quote button not appearing when “out of stock”

  • I’m using the Divi theme on my website. I want the quote button to appear only when my products are “out of stock”. However, the button is not appearing in the product page regardless of selecting the “only out of stock” option or the “all products” option.

    Screenshot: https://www.screencast.com/t/B7bNvKVh

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author wpbean

    (@wpbean)

    You may be using the Divi builder for the product page layout. It removes all the WooCommerce hooks. This is why the button does not shows up automatically.
    Please follow this doc and add this code to your theme/child theme functions.php file.

    https://docs.wpbean.com/docs/get-a-quote-button-for-woocommerce/show-quote-button-in-divi-elementor-pro/

    add_filter( 'wpb_gqb_woo_single_position', function(){
        return 'wpb_gqb_quote_button_hook';
    } );
     
    add_shortcode( 'wpb-quote-button-hook', function(){
        ob_start();
        do_action( 'wpb_gqb_quote_button_hook' );
        return ob_get_clean();
    } );

    After adding the code, open your product page template builder and add this shortcode where you want to show the button. Keep the plugin settings as it is now. The button will only show up for the out-of-stock products.

    The shortcode to add:
    [wpb-quote-button-hook]

    Thread Starter traduality

    (@traduality)

    @wpbean You’re a lifesaver! Thanks a lot for providing the solution, you’re amazing!

    It worked perfectly.

    • This reply was modified 1 year, 3 months ago by traduality.
    Thread Starter traduality

    (@traduality)

    I just realized this solution is not working for variable products. It’s working perfectly for standalone products but when a variable product is out of stock, the quote button is not appearing.

    Does anyone knows how to fix that?

    Plugin Author wpbean

    (@wpbean)

    Hi,

    I just released an update for this plugin. Please update it on your site and after that test it.

    I hope this issue will be fixed.

    Thanks

    Hello. I am using this plugin in the Hello Elementor theme. There is a need to add a quote button but it is displayed. I found the function code on this page where you added a hook for the DIVI theme. I tried it and the button worked fine. But now, when I try to open a page in ElementorPRO Single Product, I get an error. When I remove the code from function.php, the Single Product works, but the button does not. Could you tell me how best to fix the code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Quote button not appearing when “out of stock”’ is closed to new replies.