[Support request] Add to cart banner not showing on bundle products

Home Forums Support [Support request] Add to cart banner not showing on bundle products

Home Forums Support Add to cart banner not showing on bundle products

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • #1718125
    Leo
    Staff
    Customer Support

    Sounds good. We are in beta two now so hopefully not too too long.

    #1752074
    nik9

    Hello, Now GP 2.0 is available. I also already added the snipped. But it is not working as expected. Do I miss here something again? πŸ™‚

    Cheers

    #1754572
    Elvin
    Staff
    Customer Support

    Hello, Now GP 2.0 is available. I also already added the snipped. But it is not working as expected. Do I miss here something again?

    Have you installed it and then tested the code?

    IF yes and it didn’t work, can you make a copy of your site on a staging site and let us take a look on the backend? This is so if we do any change on the site, it doesn’t affect the live one.

    Let us know.

    #1754914
    nik9

    Hello Elvin,

    Yes. Please see system infos in the note field πŸ™‚

    #1757799
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Is it ok if I add some debug code to the snippet to see where the point of failure is? I see this is a live site, so perhaps a staging site would be better?

    #1764975
    nik9

    Hello Tom,

    This is a staging site. So you can play around πŸ™‚

    #1766052
    Tom
    Lead Developer
    Lead Developer

    Definitely something strange going on. Even my var_dump() functions aren’t outputting anything at all.

    Is there any server caching going on? Caching plugins maybe?

    #1766639
    nik9

    I think on staging no caching is on. Hmm.. We use WP Rocket on prod system. But on staging this should be turned off.

    #1767772
    Tom
    Lead Developer
    Lead Developer

    So I installed that plugin on my localhost and did some testing. This ended up working for me:

    add_filter( 'generate_wc_sticky_add_to_cart_action', function( $action, $product ) {
        if ( $product->is_type( 'woosb' ) ) {
    
            $quantity_buttons = '';
    
            if ( generatepress_wc_get_setting( 'quantity_buttons' ) ) {
                $quantity_buttons = ' do-quantity-buttons';
            }
    
            $args = array(
                'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
                'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
            );
    
            $action = sprintf(
                '<form action="%1$s" class="cart%2$s" method="post" enctype="multipart/form-data">
                    %3$s
                    <button type="submit" class="button alt">%4$s</button>
                </form>',
                esc_url( $product->add_to_cart_url() ),
                $quantity_buttons,
                woocommerce_quantity_input( $args, $product, false ),
                esc_html( $product->add_to_cart_text() )
            );
        }
    
       return $action;
    }, 10, 2 );
    
    add_filter( 'generate_wc_show_sticky_add_to_cart', function( $show ) {
    	$product = wc_get_product( get_the_ID() );
    
    	if ( $product->is_type( 'woosb' ) ) {
    		$show = true;
    	}
    
    	return $show;
    } );

    However, the same code isn’t working on your site. In fact, nothing is output in the panel even if I manually add some content in there. My guess is that one of your plugins is confusing/breaking one of the core WooCommerce conditionals we rely on. There are a ton of plugins on the site, so I’m not sure which one. My advice would be to keep the snippet I added and deactivate your plugins one by one to see if you can find the offending plugin.

    If it’s not a plugin, it could be one of your custom functions as well.

Viewing 9 posts - 16 through 24 (of 24 total)
  • You must be logged in to reply to this topic.