This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Getting data of all products that are on page in blocks #11907
Closed
ChrisPlaneta
started this conversation in
WooCommerce, Blocks, and Site Editing
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I am working on my own WooCommerce analytics plugin and I have a problem with the new blocks. I hope you will be able to help me.
What I want to achieve
I need to get the data of all the products that are visible on page (in the front end that the user sees) - from all the blocks. I need this data to be available in a JS object as soon as possible after the page loads.
I will use this data to track product views, product item views, additions to cart, removals from cart, etc. with my own JS. This JS will fire every time a person views a page or clicks a button, get the product that the click action was connected to, find this product data in the JS object I am trying to get and send it to tintegrated tracking tools.
What I tried
I tried WooCommerce action and filter hooks. They worked well with the non-block products but are pretty useless with the blocks. Even the newly introduced hooks mentioned here do not work with a great majority of blocks, they seem not to work the way other hooks worked or their documentation is missing.
Beta Was this translation helpful? Give feedback.
All reactions