avada.io
AVADA logo
Published on
Themes

How to add affiliate links to your Shopify store?

2593 words13 min read
Author
  • Name
    thanh
    Twitter

To build trust with customers and increase sales, adding affiliate links to your Shopify store is a smart choice. There is no denying that we live in an ever-growing and changing affiliate marketing market. Affiliate Marketing started growing from the 90s of the last century. In 2017, it accounted for 15% of the entire digital advertising market. The value of the US market is expected to grow to US $7 billion by 2020. Do you really understand Affiliate Marketing and Affiliate links? The following article will clarify these two concepts and guide you how to add affiliate links to your Shopify store.

What is affiliate marketing?

Affiliate marketing is a form of promoting products or services of the supplier, which is the company whose products or services want through the websites of partners promoting goods and services. End-user. Partners making money online receive a commission when a user visits the partner's website to manage and perform actions that the supplier wants from the end-user, such as Purchasing, registering to use services, fill in the information, etc.

How to add affiliate links to your Shopify store

In essence, Affiliate (Performance marketing base on Partnership) is that advertisers rely on publishers to promote their products. A publisher can run all forms of digital marketing and they receive a commission when a user purchases through their link. To maximize the purchasing desire of users, publishers will run advertising campaigns based on traffic platforms such as their websites, blogs, social networks or user data.

Why should you join Affiliate marketing?

  • No need to own products or services.
  • No need to worry about shipping or customer care.
  • It can participate in generating income with a low initial cost.
  • Ability to practice marketing skills through the promotion of products and services.
  • Enjoy attractive commission and always be paid on time.

The affiliate link of a product is a specific URL that contains the ID or username of the link. In affiliate programs, advertisers use affiliate links to record user traffic and the number of orders successfully sold through that affiliate link. They will be sent to the website of the marketing network where they will statistically and confirm successful orders and pay commissions to marketers.

During the sale process, there will be times when products are only made by order or they are currently unavailable. You will want to replace the "Add to cart button" with an affiliate link. This will help keep customers comfortable and keep your sales going on seamlessly.

Below, I will show you in detail how to replace the Add to cart button with an affiliate link. However, the steps will vary for the type of theme you are using. Therefore, first, go to the theme's Edit code page to determine it. If you see files in the Section directory, you are using a sectioned theme. Vice versa, if you don't see a file in that directory, a non-sectioned theme is the answer. In addition, the non-sectioned theme was released before October 2016. So if you use the theme published after that time, it will not be a non-sectioned theme. After you've determined what type of theme you're using, be sure to move to the correct section to follow the instructions.

For Section themes

Create a new product template

  • Step 1: Click Online Store in the left-hand menu from your admin page. Then, go to Themes.

How to add affiliate links to your Shopify store

  • Step 2: Make sure to find out the theme you expect it to be edited. Afterward, select the Actions button and tap on the Edit code.

How to add affiliate links to your Shopify store

  • Step 3: Choose the Add a new template in the Templates field.

How to add affiliate links to your Shopify store

  • Step 4: In this step, you will need to create the product template. Choose product in the first drop-down menu. Then, name your template requires-contact. Click the Create template to finish creating a new template.

How to add affiliate links to your Shopify store

  • Step 5: Look for the following code:

{% section 'product-template' %}

After you’ve found it, replace it with:


{% section 'product-template-requires-contact' %}

This code is used to link your new product template with a new section you will create in the next section.

  • Step 6: Tap on Save to complete.

Create a new product section

  • Step 1: Choose the Add a new section in the Sections field.

How to add affiliate links to your Shopify store

  • Step 2: You can create a new section now. Name your section product-template-requires-contact and tap Create section then.

How to add affiliate links to your Shopify store

  • Step 3: In this step, you need to delete all of the default code in the file. It should be empty so that you can move to the next step.

How to add affiliate links to your Shopify store

  • Step 4: Select the product-template.liquid file in the Section field and copy all the default code of the file to your clipboard.

How to add affiliate links to your Shopify store

  • Step 5: Back to the new product-template-requires-contact.liquid file and paste the code into that file.

How to add affiliate links to your Shopify store

  • Step 6: Finally, select the Save button.

How to add affiliate links to your Shopify store

Hide the Add to cart button

  • Step 1: From the product-template-requires-contact.liquid file, make sure to look for the HTML code for the Product form of your product page. A cool tip for you to find it faster is you can search for the word form in the file.

How to add affiliate links to your Shopify store

  • Step 2: After you’ve found the code, wrap it in Liquid {% comment %} and {% endcomment %} tags. This is used to stop showing the code in your store. However, if you expect to change your new template later, you can put it back effortlessly.

Below is an example for Narrative:


{% comment %}
{% include 'product-form' %}
{% endcomment %}


  • Step 3: Choose the Save button to have it done.

Above, you’ve hidden the Add to cart button successfully. Now, I will walk you through how to add the content you want to display instead.

An affiliate link:

As mentioned above, affiliate links bring good benefits to your business and help you earn commissions. To add an affiliate link, you can do as the following:

  • Below the Liquid {% endcomment %} tag which you’ve added in the previous section, add the following code:

<p>Please <a href="mailto:{{ shop.email }}">contact us</a> if you are interested in this product.</p>


You can replace shop.email with an affiliate link. When your customers click on it, they will be redirected to your partner’s website.

  • Remember to tap on Save before leaving.

Contact form:

Apart from an affiliate link, adding a contact form is highly recommended. You can do this by copying the code from your theme’s contact page template. Then, do these steps:

  • Open the page.contact.liquid file from the Templates field.

  • Look for the Liquid {% form 'contact' %} tag in that file.

  • Now, you need to copy all the code from the Liquid {% form 'contact' %} tag down to the Liquid {% endform %} tag. Note that it must include the Liquid form tags.

  • Back to the Templates directory and open your new product.requires-contact.liquid file then.

  • Make sure to paste the code into a new line below the Liquid {% endcomment %} tag.

  • Next, wrap the code which you’ve just pasted in HTML div tags. The class attribute is used to ensure that your contact form will render accurately on the page.

  • Paste the following code on a new line above the {% form 'contact' %}:


<div class="form-vertical">

  • Paste the following code on a new line below the {% endform %}:

  </div>

  • Click Save to finish.

Assign your new template to a product

Now that the template is completed, you need to assign it to all of your items for which you expect to hide the Add to cart button. Take these simple steps below.

  • Tap on the Products section in the admin page. Then, choose the All products.
  • Select the product’s name that you expect the Add to cart button to be hidden.
  • Under Theme templates, there is a drop-down called Template suffix. Make sure to choose your new requires-contact template.
  • Don’t forget to tap on Save.

For Non-section themes

Create a new product template

  • Step 1: Click Online Store in the left-hand menu from your admin page. Then, go to Themes.

How to add affiliate links to your Shopify store

  • Step 2: Make sure to find out the theme you expect it to be edited. Afterward, select the Actions button and tap on the Edit code.

How to add affiliate links to your Shopify store

  • Step 3: Choose the Add a new template in the Templates field.

How to add affiliate links to your Shopify store

  • Step 4: In this step, you will need to create the product template. Choose product in the first drop-down menu. Then, name your template requires-contact. Click Create template to finish creating a new template.

How to add affiliate links to your Shopify store

Hide the Add to cart button

  • Step 1: From your new product.requires-contact.liquid file that you’ve made, search for the HTML code for the Add to cart button. To find it easier, press Ctrl + F and enter the word cart.

You should know that the codes for the Add to cart button of different themes are also different. Therefore, look for tags such as or

Exclusive Offer: Shopify Deal for PageFly Audience

Start Your Online Business with Shopify 12 Day Free Trial + Pay Only 1$ For Your First Month