1

This is just a follow up from my previous questions @ Get product properties on "added_to_cart" JS events on WooCommerce single product page

Astra Pro Theme supports AJAX Add to Cart in Single Product Page:

My WooCommerce setting is as follows:

Question: Is there a way to make the same script work within Single Product Page with AJAX enabled?

Thank you.

chubby
  • 35
  • 7
  • It seems that your theme enable a custom Ajax add to cart button on single product pages, but by default there is no Ajax add to cart functionality in single product page… So that's why the "added_to_cart" JS event doesn't allow to get product data as it's not triggered by this custom Ajax add to cart button on single product pages. – LoicTheAztec Sep 30 '20 at 11:11
  • I guess it explains why it is not working for the Single Product page in my theme, as I didn't realize AJAX is not native for Single Product page. While using your code to test, in the Single Product Page, it returns the first 3 attributes in the function as console.log prints them, though missing the 'dataset: DOMStringMap' information especially in the 4th attribute... – chubby Sep 30 '20 at 16:01

0 Answers0