This is an old revision of the document!
1. Add a snippet "simple-preorder-bootstrap.liquid" with code:
<script>
// Bootstrap for Simple Preorder app
var SimplePreorderBootstrap = {
"page": {{ template | json }},
"product": {
"id": {{ product.id | json }},
"title": {{ product.title | json }},
"variants": [
{% for variant in product.variants %}
{
"id": {{variant.id}},
"inventory_quantity": '{{variant.inventory_quantity}}',
"inventory_management": '{{variant.inventory_management}}',
"inventory_policy": '{{variant.inventory_policy}}'
},
{% endfor %}
]
},
"cart": {
"items": [
{% for item in cart.items %}
{
"variant_id": {{item.variant.id}},
"product_id": {{item.product.id}},
"quantity": {{item.quantity}},
"inventory_quantity": '{{item.variant.inventory_quantity}}',
"inventory_management": '{{item.variant.inventory_management}}',
"inventory_policy": '{{item.variant.inventory_policy}}'
},
{% endfor %}
]
},
//"productSelector": "#example",
//"variantsSelector": ".example",
//"checkoutSelector": "[name='example']",
//"updateSelector": "",
"debug": true,
};
</script>
2. In the product template "product.liquid" add the code to connect the snippet:
<!-- Snippet for Simple Preorder app -->
{% include 'simple-preorder-bootstrap' %}
3. In the cart template "cart.liquid" add the code to connect the snippet:
<!-- Snippet for Simple Preorder app -->
{% include 'simple-preorder-bootstrap' %}
4. (Not mandatory) In the snippet adjust the selectors for following buttons:
If this does not work, please write to support@kad.systems