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:

4 comments

  • Hielke BrandsmaHielke Brandsma Member Posts: 25

    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: 865 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?

  • Hielke BrandsmaHielke Brandsma Member Posts: 25
    edited July 6

    Thanks Lucien,

    Maybe a bit late, but I needed some time off :-)

    Back in business again.

    We have a personalisation tool installed (clerk.io) which is working fine, BUT the only thing they and I can't achieve is the add to cart functionality.

    On Clerks side there's a template designer, which' content is pushed to our shop, let's say "Featured products" as a slider:

    The content on their side looks like this:

    Everything is collected the right way, but the only thing that's impossible to retrieve is the VID.

    Which gives me this DOM-result -> data-vid = empty

    Also the href-source is not working.

    Maybe I'm overlooking something here, so I hope you could clear some things up for me!

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 865 moderator
    edited July 16

    Hi @Hielke Brandsma,

    In which file you're working here?

    But according to the two screenshots, these looks different to me, are you sure you've the right one?

Sign In or Register to comment.