Creating an add to cart link for a secondary button on a product page with a dynamic product id

Hi,

I’m trying to figure out how to create a link for a secondary button that I can use in the product.json file.

Basically, I want a second add-to-cart button that I can use on the product page.

I’ve used a similar link on another page that works fine but that has the variant id in there. For this, I’d like it to grab the id of the current product so it’s dynamic and built into the template.

url.myshopify.com/cart/add?id={{variant.id}}&quantity=1

This is the id I need to pull out:

gid://shopify/ProductVariant/44994585526566

and would like it to sit here:

The error message I’m getting:

expected String to be a id: id: expected String to be a id: id

Not sure if this will even work or if it’s just a syntax error. Any help is appreciated.

Thanks.