How to Install ShareThis’ Tools on Shopify with Javascript Code
If you would like to customize and manage your tools through the ShareThis Platform instead of using the ShareThis Shopify App, you can follow this steps:
- Log in or sign up to the ShareThis Platform.
- Add your domain.
- Copy your unique ShareThis code. You can find your unique installation <script> code (i.e. <head> code) by navigating into Settings > Setup (in the ShareThis Platform).
- Go to Apps. Enable the App you want to display in your website.
- Log in to your Shopify website.
- In the left navigation bar, select Online Store > Themes, and from the Actions dropdown, click Edit Code.
- From the different files and folders, go to Layout and click theme.liquid.
- Paste the unique ShareThis code that you copied from step 3 into the <head> section of your website.
- (Optional) If you are adding Inline tools, choose one of the following methods. Inline tools (Inline Share Buttons, Follow Buttons or Reactions Buttons) require an extra snippet of code to work on your site.
Before customizing your theme, it’s always recommended to make a backup first, follow these instructions to duplicate the theme for a backup copy in case you want to revert the changes.
1. Adding Inline ShareThis tools to your product page using a Custom Liquid Block
You can use the Shopify theme editor to have a visual guide when placing the inline buttons code. Although not limited to the products page, you could follow these instructions and the video at the end to place the code on your product description.
Note: Before customizing your theme, it’s always recommended to make a backup first, follow these instructions to duplicate the theme for a backup copy in case you want to revert the changes.
- Go to your Online Store Dashboard.
- Click on Themes and then click on the green button that says Customize.
- Navigate to the page where you want the buttons to appear by clicking on the live preview.
- Locate your mouse in the place you want to insert the buttons, a blue small button will appear with a Add a Section label.
- Select Custom Liquid from the list.
- Copy and paste the relevant placement code in the left sidebar that just appeared.
- Share Buttons placement code:
<div class="sharethis-inline-share-buttons"></div>
- Follow Buttons placement code
<div class="sharethis-inline-follow-buttons"></div>
- Reaction Buttons placement code
<div class="sharethis-inline-reaction-buttons"></div>
- Share Buttons placement code:
- Click Save in the upper right corner.
For your convenience, here’s a preview:
2. Adding Inline ShareThis tools to your product page by editing the Theme Code
- In the left navigation bar, select Online Store > Themes and then click Actions > Edit Code.
- Within the left sidebar, scroll down to the Sections folder and select main-product.liquid (If you’re using an older theme, go to Templates and locate the product.liquid file). Then, find the following code:
{{ product.description }}
Note: You can use Control + F to search for the word “description” on it (please be sure to click on the inside of the file so you can search for content within the code editor ), try placing the buttons in a new line after the section or lines which have this name. A section/element it’s delimited with the “}” character at the end of it. - Copy and paste the relevant placement code above or below your product description.
- Share Buttons placement code:
<div class="sharethis-inline-share-buttons"></div>
- Follow Buttons placement code
<div class="sharethis-inline-follow-buttons"></div>
- Reaction Buttons placement code
<div class="sharethis-inline-reaction-buttons"></div>
- Share Buttons placement code:
For your convenience, here’s a preview:
3. Adding Inline ShareThis tools on a page or blog
- In the left navigation bar, select Online Store > Pages. Then, click on the page where you want to display your buttons in.
- Click the Show HTML <> button in the Content section.
- Copy and paste the relevant placement code below wherever you want the ShareThis tool to appear.
- Share Buttons placement code:
<div class="sharethis-inline-share-buttons"></div>
- Follow Buttons placement code
<div class="sharethis-inline-follow-buttons"></div>
- Reaction Buttons placement code
<div class="sharethis-inline-reaction-buttons"></div>
- Share Buttons placement code: