Skip to content

Instantly share code, notes, and snippets.

@alfonmga
Last active October 15, 2020 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfonmga/a57e152f419e8cbb72c06ed1f780fca3 to your computer and use it in GitHub Desktop.
Save alfonmga/a57e152f419e8cbb72c06ed1f780fca3 to your computer and use it in GitHub Desktop.
await window.Snipcart.api.cart.items.add({
id: product.id,
name: product.name,
price: 10,
url: '/',
description: product.description,
image: product.imageUrl,
customFields: [
{
name: 'Frame color',
options: [
{ name: 'black', priceModifier: 0 },
{ name: 'white', priceModifier: 1000 }
]
}
],
categories: [product.categoryId],
hasTaxesIncluded: true
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment