For a webshop project, I'm using Snipcart V 3.0
I can successfully add an item to the cart using the JavaScript SDK:
await Snipcart.api.cart.items.add({
id: 'myId',
name: 'myName',
price: 0.00,
url: 'myURL',
image: 'myImage',
quantity: 1,
maxQuantity: 2,
customFields: [{
"name": "MycustomName",
"value": "MyCustomValue"
}]
});
This works, but custom fields do not show up. What I am doing wrong here? How can I add custom fields programmatically?
The documentations states:
The add method adds an item to the cart. It can take a ProductDefinition
or an array of ProductDefinition as an argument
Product definition reference found at https://docs.snipcart.com/v3/sdk/reference#core-models-ProductDefinition isn't really helpful with respect to customFields.
Any help is appreciated!