Skip to content

Instantly share code, notes, and snippets.

@mendaomn
Created August 7, 2018 09:16
Show Gist options
  • Save mendaomn/91d93ddc3cf4b8e9ed674763c346ba0b to your computer and use it in GitHub Desktop.
Save mendaomn/91d93ddc3cf4b8e9ed674763c346ba0b to your computer and use it in GitHub Desktop.
Code used for embedding Shopify's buy button
ui.createComponent('product', {
id: theProductID,
node: myNode,
moneyFormat: '%E2%82%AC%7B%7Bamount_with_comma_separator%7D%7D',
options: {
"product": {
"variantId": "all",
"width": "100%",
"contents": {
"img": false,
"imgWithCarousel": false,
"title": false,
"variantTitle": false,
"price": true,
"description": false,
"buttonWithQuantity": false,
"quantity": false
},
"text": {
"button": "AGGIUNGI AL CARRELLO"
},
"styles": {
"product": {
"text-align": "left",
"@media (min-width: 601px)": {
"max-width": "100%",
"margin-left": "20px",
"margin-bottom": "50px"
}
},
"prices": {
"text-align": "left"
},
"price": {
"font-size": "27px",
"color": "#cdf031"
},
"compareAt": {
"font-size": "22px",
"color": "white"
},
"options": {
"max-width": "100% !important"
},
"button": {
"width": "100%",
"font-size": "12px",
"padding-top": "15px",
"padding-bottom": "15px",
"padding-left": "15px",
"padding-right": "15px"
},
"quantityInput": {
"font-size": "12px",
"padding-top": "15px",
"padding-bottom": "15px"
}
}
},
"cart": {
"contents": {
"button": true
},
"text": {
"title": "Carrello",
"total": "SUBTOTALE",
"button": "ORDINA ORA",
"notice": "Spedizioni e coupons sono aggiunti al checkout.",
"empty": "Il tuo carrello è vuoto."
},
"styles": {
"button": {
"font-size": "12px",
"padding-top": "15px",
"padding-bottom": "15px"
},
"footer": {
"background-color": "#ffffff"
}
}
},
"toggle": {
"styles": {
"count": {
"font-size": "12px"
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment