Auto-add product to cart but have customer select variant

Hey there!

Here’s my scenario, I have a sweatshirt that I want to auto-add to cart as a gift if they spend over $75 but since it is a sweatshirt I would need them to select the size. I have done something like this in the past but not with a variant selection variable. Anyone have any experience with this?

Thanks,

Sean

Please refer to the below URL to get the product api usage

https://shopify.dev/docs/api/ajax/reference/product

Get your desired product data using Ajax

Then you will have the list of available variant.

Create custom HTML block to show the variants list to user.

When user select the option you will have variant I’d needed to add item in cart.

Hope this will help…