Site logo

Archived topic

Sticky add to cart at composite products

43 replies · Started by roadlink on April 8, 2021

Viewing posts 1–15 of 44

Hi David,

I updated to GPP 2.0 beta.

Add this code as snippet. But didn't work.

Strange, that looks good to me.

Anything show if you do this?:

add_filter( 'generate_wc_sticky_add_to_cart_action', function( $action, $product ) {
    var_dump($product->is_type( 'composite' ));

    return $action;
}, 10, 2 );

Hi Tom,

I added both nothing happened.
I deleted old one added new one, nothing happened.

You can check yourself.

Hi Tom,

Our developer managed to show sticky bar with this filter.
generate_wc_show_sticky_add_to_cart

But we still can't see the QTY and Price areas in sticky bar.

I have put their codes in below.

Hi Tom,

Sure, When I add below CSS + developers' code I see this. https://prnt.sc/118bpwn

add_filter( 'generate_wc_sticky_add_to_cart_action', function( $action, $product ) {
    var_dump($product->is_type( 'composite' ));

    return $action;
}, 10, 2 );

If I use developer's code + below CSS, I see this. https://prnt.sc/118brhf

If I use only below codes together, result is better. https://prnt.sc/118c29p
It says "See Details" on the button but actually it adds the product to cart. :)

1. Can we use "add to cart" wording in there?
2. It adds only 1pcs, even I choose 5pcs.

1. You can replace the follow code with your desired Add to Cart text:

esc_html( $product->add_to_cart_text() )

So that would become:

'Add to Cart'

2. Try removing this:

if ( generatepress_wc_get_setting( 'quantity_buttons' ) ) {
    $quantity_buttons = ' do-quantity-buttons';
}

Hello Tom,

Thanks for the advice.
1. Solved.
2. If I remove that code, QTY button looks weird. https://prnt.sc/119798x
2b. Even removed above code, qty problem exist. I choose 5pcs but it adds 1pcs to cart.
3. I just realize that price doesn't seen in the stick bar.

Thank you.

Here is the latest version of the code;

So the issue seems to be related to the product type itself, as even manually entering a quantity into the quantity input doesn't work - it always adds 1 as the quantity.

I'm not sure why it would be doing that - you can test the default functionality here: https://gpsites.co/merch/product/happy-ninja-hoodie/

It may be something your developer needs to debug step by step directly on the server, as I'm not familiar with the plugin/product type you're using and what kind of changes it makes to WooCommerce.

Hi Tom,

It is definitely related with composite product.
Simple products are working very well in same website.

We will continue to try. If we find anything we will let you know.
Same developer managed to fix it for another theme, which I am trying to get rid of now.

Sounds good - I'm interested to hear what the problem is.

Hi Tom,

My developer managed to fix it. Both QTY and Price are OK now.
Also I informed "Woocommerce composite products" developer for this case. They may reach you.

Thank you for support

This archived topic is closed to new replies.