How to use addToCart() function from a customized dynamic page(dataset)?

I created my own dataset for customized product information and fields. Also the dynamic page with repeater to show the products is done, too. I hope to add a “Add to cart” button in the repeater for each product to add it to the cart. I have asked wix support several times but still can’t get a clear solution.
Is there anyone who can help with it?

Hey,

You can check out the addToCart() API reference for some examples of how to use this function.

You should also check out the Repeater API reference to see what you can do with your repeaters using code.

Hope this helps!

Dara | Corvid Team

Dear Dara,

Can you tell me if my logic is right?
So I start with addToCart() coding first and when putting in the product ID, set a parameter or array to get the product ID from the repeater?
I am still learning how to set the array for this.

Thank you for your help!

@coreyjen Hey,

You should find this post helpful.

Dara | Corvid Team