Using a variable in javascript snippet?
-
So, I am using a post-snippet with javascript to generate the shopify purchase buttons.
I wanted to create a single snippet and pass the BookID into it by variable (that way, I only have to change the homepage shortcode and it would pull the correct book)
However, if I try to pass the bookid like so<div id='product-component-{bookid}'></div>
and then in the javascript section
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('product', {
id: '{bookid}',
node: document.getElementById('product-component-{bookid}'),
...and the shortcode
[preorderbook 1234567890]
I get nothing… the variable is never passed….
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.