Add a size chart to product pages
If you sell clothing items that require customers to know their size before they make a purchase, then you can add a custom size chart to your product page.
All products that require reference to the size chart must have a Size option:

On this page
Creating a size chart page
Desktop
- From your Shopify admin, go to Online Store > Pages.
- Click Add page.
- Enter a page title.
- If you want to create a size chart that appears site-wide, then enter
Size Chart
for the page title. In the Search engine listing preview* section, the URL of the page should end in/size-chart
. - If you want to create a chart that only appears on products from a specific vendor, then enter the name of the vendor followed by
Size Chart
.
For example, if your vendor is called Great Owls, then enterGreat Owls Size Chart
for the page title. In the Search engine listing preview section, the URL of the page should end in/great-owls-size-chart
. - If you want to create a chart that only appears on a specific type of product, then enter the product type followed by
Size Chart
.
For example, if you want to display a size chart specific to shoes, then enterShoes Size Chart
for the page title. In the Search engine listing preview section, the URL of the page should end in/shoes-size-chart
.
- If you want to create a size chart that appears site-wide, then enter
- In the Content box, create a table that contains your size chart information. Customize the table to look the way you want it to:
- In the Visibility section, make sure the page is set to Visible.
- Click Save.
iPhone
- From the Shopify app, tap the … button.
- In the Sales channels section, tap Online Store.
- Tap Pages.
- Click Add page.
- Enter a page title.
- If you want to create a size chart that appears site-wide, then enter
Size Chart
for the page title. In the Search engine listing preview* section, the URL of the page should end in/size-chart
. - If you want to create a chart that only appears on products from a specific vendor, then enter the name of the vendor followed by
Size Chart
.
For example, if your vendor is called Great Owls, then enterGreat Owls Size Chart
for the page title. In the Search engine listing preview section, the URL of the page should end in/great-owls-size-chart
. - If you want to create a chart that only appears on a specific type of product, then enter the product type followed by
Size Chart
.
For example, if you want to display a size chart specific to shoes, then enterShoes Size Chart
for the page title. In the Search engine listing preview section, the URL of the page should end in/shoes-size-chart
.
- If you want to create a size chart that appears site-wide, then enter
- In the Content box, create a table that contains your size chart information. Customize the table to look the way you want it to:
- In the Visibility section, make sure the page is set to Visible.
- Click Save.
Android
- From the Shopify app, tap the … button.
- In the Sales channels section, tap Online Store.
- Tap Pages.
- Click Add page.
- Enter a page title.
- If you want to create a size chart that appears site-wide, then enter
Size Chart
for the page title. In the Search engine listing preview* section, the URL of the page should end in/size-chart
. - If you want to create a chart that only appears on products from a specific vendor, then enter the name of the vendor followed by
Size Chart
.
For example, if your vendor is called Great Owls, then enterGreat Owls Size Chart
for the page title. In the Search engine listing preview section, the URL of the page should end in/great-owls-size-chart
. - If you want to create a chart that only appears on a specific type of product, then enter the product type followed by
Size Chart
.
For example, if you want to display a size chart specific to shoes, then enterShoes Size Chart
for the page title. In the Search engine listing preview section, the URL of the page should end in/shoes-size-chart
.
- If you want to create a size chart that appears site-wide, then enter
- In the Content box, create a table that contains your size chart information. Customize the table to look the way you want it to:
- In the Visibility section, make sure the page is set to Visible.
- Click Save.
Navigate to the Code Editor
Desktop
- From your Shopify admin, go to Online Store > Themes.
- Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code.
iPhone
- From the Shopify app, tap the … button.
- In the Sales channels section, tap Online Store.
- Tap Manage themes.
- Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code.
Android
- From the Shopify app, tap the … button.
- In the Sales channels section, tap Online Store.
- Tap Manage themes.
- Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code.
Choose one of the following and create a size chart snippet
Site-wide
Creating a size chart snippet
- In the Snippets directory, click Add a new snippet.
-
Name your snippet
size-chart
, and click Create snippet: Copy the following into your
size-chart
snippet:
<div class="pop-up-modal">
<div class="pop-up-content">
<span class="close-button">×</span>
<span class="size-chart-content">{{ pages.size-chart.content }}</span>
</div>
</div>
<script>
const modal = document.querySelector('.pop-up-modal');
const trigger = document.querySelector('.trigger-pop-up');
const closeButton = document.querySelector('.close-button');
function toggleModal() {
modal.classList.toggle('show-pop-up');
}
function windowOnClick(event) {
if (event.target === modal) {
toggleModal();
}
}
trigger.addEventListener('click', toggleModal);
closeButton.addEventListener('click', toggleModal);
window.addEventListener('click', windowOnClick);
</script>
<style>
.pop-up-modal {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
display: none;
transform: scale(1.1);
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
overflow:auto;
}
.pop-up-content {
position: absolute;
top: 8%;
left: 50%;
transform: translate(-50%, 0);
background-color: white;
padding: 1rem 1.5rem;
width: auto;
border-radius: 0.5rem;
}
.pop-up-content table {
table-layout: auto;
}
.close-button {
float: right;
width: 1.5rem;
line-height: 1.5rem;
text-align: center;
cursor: pointer;
border-radius: 0.25rem;
background-color: lightgray;
}
.close-button:hover {
background-color: darkgray;
}
.show-pop-up {
z-index: 12;
opacity: 1;
display: block;
transform: scale(1);
transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
.trigger-pop-up {
margin: 10px 0 10px 0;
width: 100%;
}
@media only screen and (max-width: 749px) {
.pop-up-content,
.size-chart-content table {
width: 100%;
}
.size-chart-content th,
.size-chart-content td {
padding: 10px;
}
}
</style>
{% block "note" %} There are some changes that need to be made to the CSS styling for the themes Simple and Minimal. {% endblock %}
If you are using the theme Simple, then use this code:
<div class="pop-up-modal">
<div class="pop-up-content">
<span class="close-button">×</span>
<span class="size-chart-content">{{ pages.size-chart.content }}</span>
</div>
</div>
<script>
const modal = document.querySelector('.pop-up-modal');
const trigger = document.querySelector('.trigger-pop-up');
const closeButton = document.querySelector('.close-button');
function toggleModal() {
modal.classList.toggle('show-pop-up');
}
function windowOnClick(event) {
if (event.target === modal) {
toggleModal();
}
}
trigger.addEventListener('click', toggleModal);
closeButton.addEventListener('click', toggleModal);
window.addEventListener('click', windowOnClick);
</script>
<style>
.pop-up-modal {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
display: none;
transform: scale(1.1);
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
overflow:auto;
}
.pop-up-content {
position: absolute;
top: 8%;
left: 50%;
transform: translate(-50%, 0);
background-color: white;
padding: 1rem 1.5rem;
width: auto;
border-radius: 0.5rem;
}
.pop-up-content table {
table-layout: auto;
}
.close-button {
float: right;
width: 1.5rem;
line-height: 1.5rem;
text-align: center;
cursor: pointer;
border-radius: 0.25rem;
background-color: lightgray;
}
.close-button:hover {
background-color: darkgray;
}
.show-pop-up {
z-index: 12;
opacity: 1;
display: block;
transform: scale(1);
transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
.trigger-pop-up {
margin: 10px 0 10px 8px;
width: 50%;
}
@media only screen and (max-width: 749px) {
.pop-up-content,
.size-chart-content table {
width: 100%;
}
.size-chart-content th,
.size-chart-content td {
padding: 10px;
}
.trigger-pop-up {
width: 100%;
}
}
</style>
If you are using the theme Minimal, then use the following code:
<div class="pop-up-modal">
<div class="pop-up-content">
<span class="close-button">×</span>
<span class="size-chart-content">{{ pages.size-chart.content }}</span>
</div>
</div>
<script>
const modal = document.querySelector('.pop-up-modal');
const trigger = document.querySelector('.trigger-pop-up');
const closeButton = document.querySelector('.close-button');
function toggleModal() {
modal.classList.toggle('show-pop-up');
}
function windowOnClick(event) {
if (event.target === modal) {
toggleModal();
}
}
trigger.addEventListener('click', toggleModal);
closeButton.addEventListener('click', toggleModal);
window.addEventListener('click', windowOnClick);
</script>
<style>
.pop-up-modal {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
display: none;
transform: scale(1.1);
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
overflow:auto;
}
.pop-up-content {
position: absolute;
top: 8%;
left: 50%;
transform: translate(-50%, 0);
background-color: white;
padding: 1rem 1.5rem;
width: auto;
border-radius: 0.5rem;
}
.pop-up-content table {
table-layout: auto;
}
.close-button {
float: right;
width: 1.5rem;
line-height: 1.5rem;
text-align: center;
cursor: pointer;
border-radius: 0.25rem;
background-color: lightgray;
}
.close-button:hover {
background-color: darkgray;
}
.show-pop-up {
z-index: 12;
opacity: 1;
display: block;
transform: scale(1);
transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
.trigger-pop-up {
margin: 10px 0 10px 0;
width: 100%;
}
@media only screen and (max-width: 749px) {
.pop-up-content,
.size-chart-content table {
width: 100%;
}
.size-chart-content th,
.size-chart-content td {
padding: 10px;
}
}
@media only screen and (min-width: 750px) {
.trigger-pop-up {
width: 50%;
}
}
</style>
Add the size chart snippet into your theme.liquid
- In the Layout directory, click to open your
theme.liquid
file. - Find the closing
</body>
tag. Right above the closing</body>
tag, paste the following code:
{% if request.page_type == 'product' %}
{% if product.options contains 'Size' %}
{% render 'size-chart' %}
{% endif %}
{% endif %}
Add a Size chart button
- In the Sections directory, click to open your
product-template.liquid
file orproduct.liquid
file if you don't have aproduct-template.liquid
file. - Paste the following code above the Add to cart button:
{% if product.options contains 'Size' %}
<a class="trigger-pop-up btn">See Size Chart</a>
{% endif %}
The Add to cart button typically starts with something like <button type="submit" name="add"
. If your store's operating language isn't English, then replace See Size Chart
with the text that you prefer to use.
Type
Creating a size chart snippet
- In the Snippets directory, click Add a new snippet.
-
Name your snippet
size-chart
, and click Create snippet: Copy the following into your
size-chart
snippet:
{% assign chart = product.type | handleize | append: "-size-chart" %} {% unless
pages[chart].empty? or pages[chart].content == blank %}
<div class="pop-up-modal">
<div class="pop-up-content">
<span class="close-button">×</span>
<span class="size-chart-content">{{ pages[chart].content }}</span>
</div>
</div>
{% endunless %}
<script>
const modal = document.querySelector('.pop-up-modal');
const trigger = document.querySelector('.trigger-pop-up');
const closeButton = document.querySelector('.close-button');
function toggleModal() {
modal.classList.toggle('show-pop-up');
}
function windowOnClick(event) {
if (event.target === modal) {
toggleModal();
}
}
trigger.addEventListener('click', toggleModal);
closeButton.addEventListener('click', toggleModal);
window.addEventListener('click', windowOnClick);
</script>
<style>
.pop-up-modal {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
display: none;
transform: scale(1.1);
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
overflow:auto;
}
.pop-up-content {
position: absolute;
top: 8%;
left: 50%;
transform: translate(-50%, 0);
background-color: white;
padding: 1rem 1.5rem;
width: auto;
border-radius: 0.5rem;
}
.pop-up-content table {
table-layout: auto;
}
.close-button {
float: right;
width: 1.5rem;
line-height: 1.5rem;
text-align: center;
cursor: pointer;
border-radius: 0.25rem;
background-color: lightgray;
}
.close-button:hover {
background-color: darkgray;
}
.show-pop-up {
z-index: 12;
opacity: 1;
display: block;
transform: scale(1);
transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
.trigger-pop-up {
margin: 10px 0 10px 0;
width: 100%;
}
@media only screen and (max-width: 749px) {
.pop-up-content,
.size-chart-content table {
width: 100%;
}
.size-chart-content th,
.size-chart-content td {
padding: 10px;
}
}
</style>
If you are using the theme Simple, replace from .trigger-pop-up
to right above </style>
with this code:
.trigger-pop-up {
margin: 10px 0 10px 8px;
width: 50%;
}
@media only screen and (max-width: 749px) {
.pop-up-content,
.size-chart-content table {
width: 100%;
}
.size-chart-content th,
.size-chart-content td {
padding: 10px;
}
.trigger-pop-up {
width: 100%;
}
}
If you are using the theme Minimal, add the following code above the closing </style>
tag:
@media only screen and (min-width: 750px) {
.trigger-pop-up {
width: 50%;
}
}
Add the size chart snippet into your theme.liquid
- In the Layout directory, click to open your
theme.liquid
file. - Find the closing
</body>
tag. Right above the closing</body>
tag, paste the following code:
{% if request.page_type == 'product' %}
{% if product.options contains 'Size' %}
{% assign chart = product.type | handleize | append: "-size-chart" %}
{% unless pages[chart].empty? or pages[chart].content == blank %}
{% render 'size-chart' %}
{% endunless %}
{% endif %}
{% endif %}
Add a Size chart button
- In the Sections directory, click to open your
product-template.liquid
file orproduct.liquid
file if you don't have aproduct-template.liquid
file. - Paste the following code above the Add to cart button:
{% if product.options contains 'Size' %}
{% assign chart = product.type | handleize | append: "-size-chart" %}
{% unless pages[chart].empty? or pages[chart].content == blank %}
<a class="trigger-pop-up btn">See Size Chart</a>
{% endunless %}
{% endif %}
The Add to cart button typically starts with something like <button type="submit" name="add"
. If your store's operating language isn't English, then replace See Size Chart
with the text that you prefer to use.
Vendor
Creating a size chart snippet
- In the Snippets directory, click Add a new snippet.
-
Name your snippet
size-chart
, and click Create snippet: Copy the following into your
size-chart
snippet:
{% assign chart = product.vendor | handleize | append: "-size-chart" %} {%
unless pages[chart].empty? or pages[chart].content == blank %}
<div class="pop-up-modal">
<div class="pop-up-content">
<span class="close-button">×</span>
<span class="size-chart-content">{{ pages[chart].content }}</span>
</div>
</div>
{% endunless %}
<script>
const modal = document.querySelector('.pop-up-modal');
const trigger = document.querySelector('.trigger-pop-up');
const closeButton = document.querySelector('.close-button');
function toggleModal() {
modal.classList.toggle('show-pop-up');
}
function windowOnClick(event) {
if (event.target === modal) {
toggleModal();
}
}
trigger.addEventListener('click', toggleModal);
closeButton.addEventListener('click', toggleModal);
window.addEventListener('click', windowOnClick);
</script>
<style>
.pop-up-modal {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
display: none;
transform: scale(1.1);
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
overflow:auto;
}
.pop-up-content {
position: absolute;
top: 8%;
left: 50%;
transform: translate(-50%, 0);
background-color: white;
padding: 1rem 1.5rem;
width: auto;
border-radius: 0.5rem;
}
.pop-up-content table {
table-layout: auto;
}
.close-button {
float: right;
width: 1.5rem;
line-height: 1.5rem;
text-align: center;
cursor: pointer;
border-radius: 0.25rem;
background-color: lightgray;
}
.close-button:hover {
background-color: darkgray;
}
.show-pop-up {
z-index: 12;
opacity: 1;
display: block;
transform: scale(1);
transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
.trigger-pop-up {
margin: 10px 0 10px 0;
width: 100%;
}
@media only screen and (max-width: 749px) {
.pop-up-content,
.size-chart-content table {
width: 100%;
}
.size-chart-content th,
.size-chart-content td {
padding: 10px;
}
}
</style>
If you are using the theme Simple, replace from .trigger-pop-up
to right above </style>
with this code:
.trigger-pop-up {
margin: 10px 0 10px 8px;
width: 50%;
}
@media only screen and (max-width: 749px) {
.pop-up-content,
.size-chart-content table {
width: 100%;
}
.size-chart-content th,
.size-chart-content td {
padding: 10px;
}
.trigger-pop-up {
width: 100%;
}
}
If you are using the theme Minimal, add the following code above the closing </style>
tag:
@media only screen and (min-width: 750px) {
.trigger-pop-up {
width: 50%;
}
}
Add the size chart snippet into your theme.liquid
- In the Layout directory, click to open your
theme.liquid
file. - Find the closing
</body>
tag. Right above the closing</body>
tag, paste the following code:
{% if request.page_type == 'product' %}
{% if product.options contains 'Size' %}
{% assign chart = product.vendor | handleize | append: "-size-chart" %}
{% unless pages[chart].empty? or pages[chart].content == blank %}
{% render 'size-chart' %}
{% endunless %}
{% endif %}
{% endif %}
Add a Size chart button
- In the Sections directory, click to open your
product-template.liquid
file orproduct.liquid
file if you don't have aproduct-template.liquid
file. - Paste the following code above the Add to cart button:
{% if product.options contains 'Size' %}
{% assign chart = product.vendor | handleize | append: "-size-chart" %}
{% unless pages[chart].empty? or pages[chart].content == blank %}
<a class="trigger-pop-up btn">See Size Chart</a>
{% endunless %}
{% endif %}
The Add to cart button typically starts with something like <button type="submit" name="add"
. If your store's operating language isn't English, then replace See Size Chart
with the text that you prefer to use.