✅ GOAL:
You want to:
- ✅ Design a Size Chart using Shopify’s Page Editor
- ✅ Show a “Size Chart” link on the product page
- ✅ On click, show the page content in a popup (fully working)
🧩 STEP-BY-STEP WORKING METHOD (Rechecked July 2025)
✅ 1. Create the Page in Shopify
- Go to: Online Store → Pages → Add page
- Title: Size Chart
- Content: Add your text/table/image here
- Save
- Note the handle: it will be size-chart (if that’s the title)
✅ 2. Create a Custom Snippet (Reusable)
Go to Online Store → Edit Code → Snippets → Add a new snippet
Name: size-chart-popup
Paste this liquid working version:
× {% assign size_chart_page = pages[‘size-chart’] %} {{ size_chart_page.content }}
document.addEventListener(‘DOMContentLoaded’, function () {
const openBtn = document.getElementById(‘open-size-chart’);
const closeBtn = document.getElementById(‘close-size-chart’);
const modal = document.getElementById(‘size-chart-modal’);
openBtn.addEventListener(‘click’, function (e) {
e.preventDefault();
modal.style.display = ‘block’;
});
closeBtn.addEventListener(‘click’, function () {
modal.style.display = ‘none’;
});
window.addEventListener(‘click’, function (e) {
if (e.target == modal) {
modal.style.display = ‘none’;
}
});
});
✅ This version works without using fetch or AJAX, so it avoids all Shopify CSP restrictions.
✅ 3. Render the Snippet on Product Page
Open: sections/main-product.liquid
Paste this where you want the Size Chart link to appear (usually near variant selector or before buy buttons):
{% render ‘size-chart-popup’ %}