OBJECTIVE: Not all of my products are instantly bookable and so for certain products I wish to have a primary call to action which is a ‘Book on request’ button which should either click to an enquiry form or open an email.
APPROACH: I understand (both from Shopify support & Chat GPT) that the way to do this is to:
-
Create a second product template (product.on-request.json)
-
Create a new section (or snippet) for the ‘book on request’ button (product-on-request-button.liquid)
-
Customise the new template to remove the buy buttons and reference the ‘book on request’ section
-
Select the new template for the applicable products
PROBLEM: However when doing this (code below as advised by Shopify support) I get an ‘Invalid JSON: unexpected token’ error when saving the customisation to the template (step 3). One thing I do note is that the format/structure of the code for referencing the new section is entirely different to the way other sections are referenced in the file.
QUESTION: Is the problem here the approach or the code? Would anyone be able to review code below and advice how to correct?
Thanks in advance, Rupert
CODE (STEP 2, new section, product-on-request-button.liquid):
<a href="mailto:name@company.com?subject=Request to book {{product.sku}}
{{ product.title }}&body=I’m interested in booking {{ product.sku }} with the following trip details:
Date Number of travellers Any specific options
." class=“custom-email-button”>Book on Request
{% schema %}
{
“name”: “product-on-request-button”,
“settings”: ,
“blocks”: [
{
“type”: “request_button”,
“name”: “Request Button”,
“settings”:
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
CODE: STEP 3 (New template, product.on-request.json)
{% section ‘product-on-request-button’ %},
TYPICAL CODE STRUCTURE TEMPLATE PAGE
“price”: {
“type”: “price”,
“settings”: {
}
},
“variant_picker”: {
“type”: “variant_picker”,
“settings”: {
“picker_type”: “button”
}
},