Skip to content

Instantly share code, notes, and snippets.

@carolineschnapp
Created May 27, 2015 23:25
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save carolineschnapp/288da541ea2b69aedc3b to your computer and use it in GitHub Desktop.
Save carolineschnapp/288da541ea2b69aedc3b to your computer and use it in GitHub Desktop.
How to add a Size Chart button to the #Brooklyn theme. This uses the Magnific Popup plugin that comes with the theme.

What you want

You want a See Size Chart button on the product page:

Alt text

... that once clicked gives you this:

Alt text

How to get there

  1. Create a page that contains your Size Chart. Set its handle to size-chart.

  2. Add a Size Chart button above your Add To cart button in product.liquid:

    {% if product.options contains 'Size' %}
    <a class="btn open-popup" href="#size-chart">See size chart</a>
    {% endif %}
  3. At the bottom of product.liquid, add this:

    <div id="size-chart" class="mfp-hide">
      {{ pages.size-chart.content }}
    </div>
    <style>
    #size-chart {
      border: 1px #555 solid;
      background-color: #ffffff;
      padding: 20px;
      max-width: 800px;
      margin-left: auto;
      margin-right: auto;
    }
    </style>
  4. Before </body> tag in theme.liquid, add this:

    {% if settings.product_zoom_enable and template contains 'product' %}
      <script>
        $('.open-popup').magnificPopup({
          type:'inline',
          midClick: true
        });
      </script>
    {% endif %}
@Vividsquid
Copy link

Brilliant Thanks!

if product.options contains 'Size'

-this IF statement queries for 'Size' in product options

if product.tags contains '3600'

-taken from the FIGHTSU video, queries product tags for 3600

Can somebody shed some light how i may base my query on Variant SKU?
trying the following with little joy

{% if product.variant.sku contains 'X03' %}

@pulkit5454
Copy link

pulkit5454 commented Apr 2, 2017

Hi @brandtam / @Vividsquid

I was trying to follow your instructions:

  1. I In theme.js.liquid

1

  1. In sections/product-template.liquid, I did this:

First at the top:

image

And at the bottom:

image

But still cant see the button, do you think I am doing something wrong?

Thanks
Pulkit

@tricepad
Copy link

@brandtam
hello,

Thanks for the tip. The only problem is once the code is installed.
Everything works perfectly, but when I put an article in the basket, instead of opening the side page of the basket on the right. it opens a new shopping cart page, which is annoying for the customer shopping
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment