Need to make add to cart buttons on third party elements.

AemaisAemais Member Posts: 1

I am currently trying to implement Clerk.io recommendations on a lightspeed site. As a part of this implementation I would like to make direct add to cart buttons.


The data imported to clerk, and thus the data sent back from them does not include VID. To my understanding I need this in order to create the needed form submission.


Is there a way to pull the default VID, for products which don't actually contain variations, through a simple API call. My thoughts were, I could then add them to my elements via a script on render.


Any help or hints are much appreciated.

Tags:

2 comments

  • Hielke BrandsmaHielke Brandsma Member Posts: 18

    I would like to see this functionality implemented also :-)

    I'm running into trouble when I want to retrieve the VID of certain products. When I check the "variants" segment, I only see "id": false.

    This only through API.

    From inside a template file it's possible to retrieve variants and ID's, so why not via API?

    Anyone who can clear this up?

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 299 moderator

    Hi,

    Thank you for contacting us.

    You can do this by doing a request to the variants endpoint by using the productID.

    GET /variants.json?product={product_id}
    

    If this is not what you're looking for, please let me know what calls are you making now and what you're trying to achieve?

Sign In or Register to comment.