Caution
This is an advanced tutorial and is not supported by Shopify. Knowledge of HTML, CSS, JavaScript, and Liquid is required. Consider hiring a Shopify Expert if you aren’t comfortable doing the steps in the tutorial.
Twitter Cards make it possible for you to attach media experiences to Tweets that link to your store content. Simply add a snippet to your theme, and visitors who Tweet your products and blog posts will have an attractive “card” added to their Tweet that will be visible to all their followers.
Create a Twitter account
You will need a Twitter account for this. If you already have a Twitter account, then jump ahead to the next step.
- If you don’t have a Twitter account, go to https://twitter.com/signup.
- Fill out the account creation form.
- Click Create my account.
Create your snippet
-
From your Shopify admin, go to Online Store > Themes.
-
Find the theme you want to edit, and then click Actions > Edit code.
-
Click the Snippets heading to reveal the Snippets content.
-
Look for a snippet called
twitter-cards.liquid. It’s possible that your theme already contains that snippet. If it does, then you need to skip ahead to the Submit your website to Twitter section. -
Under Snippets, click Add a new snippet. Create a snippet called
twitter-card. -
In your new
twitter-card.liquidsnippet, add the code here. -
Save your snippet file.
-
Still on the Edit HTML/CSS page, under Layouts, click
theme.liquid: -
Locate the closing
</head>tag, and right above it, add this code:{% render 'twitter-card' %}Like so:
-
Save your file.
Submit your website to Twitter
Next, you will test your store’s URL by validating it using the Twitter card validator.
-
Go to your storefront and browse to a random product page.
-
Grab that product page URL from your browser address bar: select it, then use Ctrl+C on Windows, or Cmd+C on the Mac.
-
Head over to the Twitter Card Validator page.
-
In the Card URL field, paste your product page URL.
-
Click Preview card:






