I recently came across to an issue with adding the custom ‘Add to Cart’ button and using dynamic data to populate the product I wish to add to cart.
I created a landing page (pricing table) with 3 products on it. I wanted to add only a ‘Add to Cart’ button for each of the products, and I needed this button to add the linked product to the cart.
I was hoping to add a regular ‘Button’ element to the page, then assign ‘Dynamic Data’ to the button’s ‘Link Type’, from here choose the {woo_add_to_cart} dynamic variable, and then I was hoping to see another dropdown that would let me choose the actual product that I want to assign to the button.
Unless it already works this way, I didn’t quite manage to figure it out.
Instead I ended up choosing ‘External URL’ in the ‘Link Type’ of the button and then adding ‘?add-to-cart=10’ into the URL field, where ‘10’ is the ID of my product that I want to add to cart.
I repeated the same for the remaining 2 buttons.
It works, but is there a way to do this more dynamically? The process I described above with the product selection is used by Elementor I believe.
Jo