Hello,
I need also to display products with Query loop in content pages, with the “add to cart” button.
Beginning of a solution…
I created a grid of products manually (without loop) with this button :
<a class="gb-button add_to_cart_button ajax_add_to_cart" href="#" data-product_id="1">Add</a>
Note : I looked at GP code (Shop page) and I took some elements to avoid a reload (and I delete href=”?add-to-cart=1″)
> class : “add_to_cart_button ajax_add_to_cart”
> data : “data-product_id”
It works well (except that I don’t have the nice bar that appears at the top indicating that the product is well added, compared to GP Shop page)
My question :
Is there a way to create this button in a Query loop with “generateblocks_query_loop_args” or something else ?
> Add a custom attribute with the product ID variable : “data-product_id = id”
I am so close and at the same time so far from finding a solution 😭!! It would be great to create custom product listings using Query loop 🤩
Thanks for your help