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,
HI,
thanks so much for the quick response!
I use a plugin that allows me to view the products in the table (https://wordpress.org/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
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.
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 contact@tagconcierge.com
All the best,
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 🙂
Hey @saracoming,
nice, great to hear that you solved it. Do you read the product variant details from HTML directly?
Hi,
Yes, exactly, even if it’s not the nicest thing to do, it allowed me to get all the items I needed