• Resolved saracomin

    (@saracomin)


    Hi, I saw that the click event is only caught via certain classes (.cart .single_add_to_cart_button, ajax_add_to_cart), is it possible to add the event to another class?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tag Concierge

    (@tagconcierge)

    Hey @saracomin,

    good catch. Currently, it is not supported to easily customise those classes. Can you share with me what exactly you try to achieve?

    Is it about custom theme implementation or about some extra add to cart buttons that go beyond typical Woo setup?

    Eager to learn more,

    Thread Starter saracomin

    (@saracomin)

    HI,

    thanks so much for the quick response!
    I use a plugin that allows me to view the products in the table (https://www.ads-software.com/plugins/woo-product-table/), because the woocommerce class view for the project I developed wasn’t right for me

    an example for their website
    https://demo.wooproducttable.com/product/samsung-galaxy/
    button add to cart has to trigger the event

    Plugin Author Tag Concierge

    (@tagconcierge)

    Hello @saracomin again,

    sorry for not getting back before the weekend.

    Unfortunately, the FREE version of our plugin available here won’t support that out-of-the-box. I mean even if you modify the code and listen to custom add_to_cart button classes, you would encounter issues with getting the details of actual product (variation name, price which can be different for each variation).

    Our paid plugin would make that slightly easier, because we detect if product type is variable, then we make all variants details available for JS.

    Alternatively, maybe there is an option to make this table plugin reload page on add_to_cart, then the event can be generated server-side. Either way we would need to extend even the PRO version to support this plugin.

    I don’t want to only steer you towards our paid offering, so you may want to look how the default add_to_cart event is implemented in this plugin and try to duplicate that code and extending it to cover your use case:

    https://github.com/tagconcierge/tc-woocommerce-plugin-free/blob/develop/src/EventStrategy/AddToCartStrategy.php

    If you decide going that path I can help figuring out how to connect that with existing plugin.

    Let me know if that was of any help.

    Plugin Author Tag Concierge

    (@tagconcierge)

    Hey @saracomin,

    I will allow myself to close this thread for now. If you would like to get back to this topic feel free to continue it, open another thread or send us an email at [email protected]

    All the best,

    Thread Starter saracomin

    (@saracomin)

    Hi,

    In the end I solved it by using the same js code but adapting it to the data present in the product table on the page ??

    Plugin Author Tag Concierge

    (@tagconcierge)

    Hey @saracoming,

    nice, great to hear that you solved it. Do you read the product variant details from HTML directly?

    Thread Starter saracomin

    (@saracomin)

    Hi,

    Yes, exactly, even if it’s not the nicest thing to do, it allowed me to get all the items I needed

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add to cart event on custom button class’ is closed to new replies.