Skip to content

Instantly share code, notes, and snippets.

@althaffe
Created February 18, 2018 04:23
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 althaffe/c24bf020e02c9d6c7979e41bb8a7699d to your computer and use it in GitHub Desktop.
Save althaffe/c24bf020e02c9d6c7979e41bb8a7699d to your computer and use it in GitHub Desktop.
Cosmic JS add to bucket
let content = ''
items.forEach(item => {
content+= `${item.title} x ${item.count}, `
})
const params = {
type_slug: 'orders',
title: name,
content: content,
metafields: [
{
key: 'Address',
type: 'text',
value: address
},
{
key: 'City',
type: 'text',
value: city
}
]
}
cosmic.addObject(params).then(data => {
...
}).catch(err => {
...
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment