How to replace your Add to cart button with your own Xion Checkout Button on your Shopify store
This is to hide your default add to cart button on your Shopify store product and replace it with your Xion Checkout Button.
Create a new product template
To replace the Add to cart button for a product, you will need to create a custom product template for that product.
Steps:
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.
Create the product template:
a. From the drop-down menu, select product.
b. Name your template requires-contact.
c. Click Create template.
5. Find the following code:
{% section 'product-template' %}
Replace it with:
{% section 'product-template-requires-contact' %}
This code links your new template with a new product section that you will create in the next steps.
6. Click Save.
Create a new product section
In the Sections directory, click Add a new section.
Create the section:
a. Name your new section product-template-requires-contact.
b. Click Create section.
Delete all of the default code in the section file, so that the file is empty.
In the Sections directory, click product-template.liquid. Copy all the content of the file to your clipboard.
Return to your new product-template-requires-contact.liquid section, and paste the code into the file.
Hide the Add to cart button
In your new product-template-requires-contact.liquid section file, find the HTML code for the Add to cart button of your product page. You can find it by searching for the word cart in the file. The code for the Add to cart button varies from theme to theme. Look for an <input> or <button> tag with text like Add to cart, AddToCart, or add-to-cart.
For Debut, the Add to cart button code looks like this:
2. When you find the code, wrap it in Liquid {%comment%}
and {%endcomment%}
tags.This will stop the code from being shown on your store, but will let you easily put it back if you want to change your new template later.
For Debut, the modified code would look like this:
Caution > Make sure that you don't comment out the tags for your product page. You comment tags should not surround any or tags, otherwise customers might experience errors when viewing your product page.
3. Click Save.
Add your Checkout Button Code
Now that you have hidden the Add to cart button, you can add the Checkout Button you want to show instead.
On a new line below the Liquid {% endcomment %}
tag that you added in the last step, add the Checkout Button Code(In COPY SCRIPT pop up).
Assign your new template to a product
Now that the template is finished, you can assign it to the product for which you want to replace the Add to cart button with your Checkout Button.
From your Shopify admin, go to Products.
Click the name of a product that you want to hide the Add to cart button on.
On the product page of your Shopify admin, under Theme templates, choose your new requirescontact template from the Template suffix drop-down.
Note – You will have to repeat these steps to create new templates for every new Checkout Button that you create in Xion.