TUTORIAL 1.0 Sectioned Theme
| CONSIDERATION
Changing text of Add To Cart (ATC) button on product page. Button functionality does not change (perform the same as an actual ATC button). This is recommended for products with the following settings:
- PRE-ORDER for products that have went out-of-stock.
- BULK PURCHASE with dateline.
- /or products that need longer than the usual to fulfil.
You are required to complete all the steps below or email at eaidter@gmail.com to hire us with minimal cost.
- Duplicate your theme first to keep it as a back-up before trying this advanced coding
- Keyboard shortcut to find specific text line: Place cursor on the code editor screen and hold
CTRL + F
-
From your Shopify admin, go to Online Store > Themes.
-
Find the theme you want to edit, and then click Actions > Edit code.
-
In the Templates directory, click Add a new template and follow according as below:
- Create a new template for
product
- Template type
liquid
- File name > replace 'alternate' to
pre-order
(or to any of your preferred name and this will change the struction below)
Next, click Create template and the new created template file for
product.pre-order.liquid
will open in the code editor. - Create a new template for
-
Find the following code within the new created template file:
{% section 'product-template' %}
Replace it with:
{% section 'product-pre-order-template' %}
In the same file, look for a
<script>
tag that contains this line of code:addToCart: {{ 'products.product.add_to_cart' | t | json }},
Replace it with:
addToCart: {{ 'Pre-order' | json }},
Next, click Save.
-
In the Sections directory, click Add a new section and add the following
- Create a new section called
product-pre-order-template
Next, click Create section and the new created section file for
product-pre-order-template.liquid
will open in the code editor. - Create a new section called
-
Delete all of the default code, so that the new created section file is blank.
-
Find and open file named
product-template.liquid
under the Sections directory. -
Select and copy all of the content from this file, and paste it into your new
product-pre-order-template.liquid
file. -
In your new product-pre-order-template.liquid file, find and replace the Add to cart button text.
Look for this code:
<span data-add-to-cart-text> {% unless current_variant.available %} {{ 'products.product.sold_out' | t }} {% else %} {{ 'products.product.add_to_cart' | t }} {% endunless %} </span>
Replace it with:
<span data-add-to-cart-text> {{ 'Pre-order' | json | remove: '"' }} </span>
Next, click Save.
-
From your Shopify admin, go to Products > All products
-
Click the name of the product you want to make available for pre-order
-
Scroll down to find Theme templates and change the template to product.pre-order in the drop-down option
-
Click Save
TIPS: Use bulk editor to assign the template to more than 3 products
Refer to Github file - Consideration_CHG-ATC-BTN