Back to Shopify Liquid
How to use v3
Shopify Liquid

How to use v3

A product instruction section that displays a four-step 'How to use' guide using a CSS grid layout. It features flavor-based data attributes to potentially toggle visibility based on selected product variants.

EasyProduct PageInstructionalGraphicsCROUser Manual
251 lines · 11.8 KB
Setup 5–10 minutes 5 min read 251 lines
Key features
  • Responsive 4-column grid layout
  • Variant/Flavor based display logic via data attributes
  • Aspect-ratio controlled images with object-fit coverage
  • Mobile-optimized 2-column fallback view
Best use cases
  • Providing step-by-step usage instructions for consumables or supplements.
  • Displaying different instructions based on selected product flavors or variants.
Compatibility
  • Most Shopify themes

The code

Shopify Liquid
1<div id="shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn" class="shopify-section">
2
3
4<style>
5 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .section_holder_wrapper {
6 padding: 0 80px;
7 max-width: 1360px;
8 margin: auto;
9 }
10 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .section_title {
11 align-self: stretch;
12 color: #000001;
13 font-size: 30px;
14 font-weight: 400;
15 line-height: 1;
16 max-width: 100%;
17 margin-left: 16px;
18 margin-bottom: 48px;
19 text-align: left;
20 }
21 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .section_items {
22 display: grid;
23 grid-template-columns: 1fr 1fr 1fr 1fr;
24 grid-gap: 32px;
25 }
26 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .section_item {
27 min-width: 1px;
28 width: 100%;
29 display: none;
30 }
31 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .item_image {
32 padding-top: 500px;
33 position: relative;
34 margin-bottom: 24px;
35 }
36 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .item_text {
37 align-self: stretch;
38 color: #000;
39 display: flex;
40 flex-direction: column;
41 font-size: 16px;
42 font-weight: 400;
43 justify-content: flex-start;
44 line-height: 1.5;
45 max-width: 100%;
46 position: relative;
47 }
48 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .item_image img {
49 position: absolute;
50 top: 0;
51 width: 100%;
52 height: 100%;
53 object-fit: cover;
54border-radius: 8px;
55 }
56 @media screen and (max-width: 1024px) {
57 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .section_items {
58 grid-template-columns: 1fr 1fr;
59 grid-gap: 20px;
60 }
61 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .section_holder_wrapper {
62 padding: 0 24px;
63 }
64 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .section_title {
65 margin-left: 0;
66 margin-bottom: 30px;
67 }
68 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .item_image {
69 padding-top: 111.8%;
70 max-height: 400px;
71 }
72 #shopify-section-template--17389125894327__pdp_how_to_use_QnMRQn .item_text {
73 font-size: 15px;
74 }
75 }
76</style>
77
78<div pdp_howtouse="" id="pdp_how_to_use_MRQn" class="section_holder">
79 <div class="section_holder_wrapper">
80<h2 style= "font-weight: 600; text-align: center; color: #2d2d2d"> How to use! </h2>
81 <div class="section_items">
82
83 <div class="section_item" data-flavor="Coffee" style="display: block;">
84 <div class="item_image">
85 <img src=https://cdn.shopify.com/s/files/1/0798/4267/2987/files/Energy2.webp?v=1736739401" alt="Image">
86 </div>
87
88 <div class="item_text">1) how to use point example 1</div>
89 </div>
90
91 <div class="section_item" data-flavor="Coffee" style="display: block;">
92 <div class="item_image">
93 <img src="https://cdn.shopify.com/s/files/1/0798/4267/2987/files/Energy3.webp?v=1736739403" alt="Image">
94 </div>
95
96 <div class="item_text">2) how to use point example 2</div>
97 </div>
98
99 <div class="section_item" data-flavor="Coffee" style="display: block;">
100 <div class="item_image">
101 <img src="https://cdn.shopify.com/s/files/1/0798/4267/2987/files/Energy7.webp?v=1736739413" alt="Image">
102 </div>
103
104 <div class="item_text">3) how to use point example 3</div>
105 </div>
106
107 <div class="section_item" data-flavor="Coffee" style="display: block;">
108 <div class="item_image">
109 <img src="https://cdn.shopify.com/s/files/1/0798/4267/2987/files/Energy5.webp?v=1736739406" alt="Image">
110 </div>
111
112 <div class="item_text">4) how to use point example 4</div>
113 </div>
114
115 <div class="section_item" data-flavor="Chocolate" style="display: none;">
116 <div class="item_image">
117 <img src="//spacegoods.com/cdn/shop/files/2024-09-29_23-33-40_B_R8_S4_CHOC_1x1_d6c6c5d8-e0b7-4203-bb59-a2063ca9b251_1000x.jpg?v=1728025685" alt="Image">
118 </div>
119
120 <div class="item_text">1) scoop 8g of Rainbow Dust</div>
121 </div>
122
123 <div class="section_item" data-flavor="Chocolate" style="display: none;">
124 <div class="item_image">
125 <img src="//spacegoods.com/cdn/shop/files/mix_2_1000x.webp?v=1720520021" alt="Image">
126 </div>
127
128 <div class="item_text">2) mix with water or milk - hot or cold</div>
129 </div>
130
131 <div class="section_item" data-flavor="Chocolate" style="display: none;">
132 <div class="item_image">
133 <img src="//spacegoods.com/cdn/shop/files/frother_3_1000x.webp?v=1720520021" alt="Image">
134 </div>
135
136 <div class="item_text">3) use your frother to blend to perfection</div>
137 </div>
138
139 <div class="section_item" data-flavor="Chocolate" style="display: none;">
140 <div class="item_image">
141 <img src="//spacegoods.com/cdn/shop/files/SCC00936_1x1_77b9b3d3-2afe-4964-b522-e4aa8d233d06_1000x.jpg?v=1728025943" alt="Image">
142 </div>
143
144 <div class="item_text">4) drink &amp; enjoy focus - energy - calm</div>
145 </div>
146
147 <div class="section_item" data-flavor="Vanilla Cinnamon" style="display: none;">
148 <div class="item_image">
149 <img src="//spacegoods.com/cdn/shop/files/2024-09-29_23-33-40_B_R8_S4_CIN_1x1_1b50a2f7-28e4-4630-b92d-500a1794a20c_1000x.jpg?v=1728025746" alt="Image">
150 </div>
151
152 <div class="item_text">1) scoop 8g of Rainbow Dust</div>
153 </div>
154
155 <div class="section_item" data-flavor="Vanilla Cinnamon" style="display: none;">
156 <div class="item_image">
157 <img src="//spacegoods.com/cdn/shop/files/2024-09-29_23-41-00_B_R8_S4_H_1x1_f551f486-0062-46ef-8cf0-96e498376a8a_1000x.jpg?v=1728026249" alt="Image">
158 </div>
159
160 <div class="item_text">2) mix with water or milk - hot or cold</div>
161 </div>
162
163 <div class="section_item" data-flavor="Vanilla Cinnamon" style="display: none;">
164 <div class="item_image">
165 <img src="//spacegoods.com/cdn/shop/files/SCC00615_1x1_552b872c-8020-4cd7-81d3-17c3f7d04b5d_1000x.jpg?v=1728026331" alt="Image">
166 </div>
167
168 <div class="item_text">3) use your frother to blend to perfection</div>
169 </div>
170
171 <div class="section_item" data-flavor="Vanilla Cinnamon" style="display: none;">
172 <div class="item_image">
173 <img src="//spacegoods.com/cdn/shop/files/SCC00855_1x1_b9963ffd-9dc1-40d5-85c7-9680e7546a67_1000x.jpg?v=1728025978" alt="Image">
174 </div>
175
176 <div class="item_text">4) drink &amp; enjoy focus - energy - calm</div>
177 </div>
178
179 <div class="section_item" data-flavor="Strawberry" style="display: none;">
180 <div class="item_image">
181 <img src="//spacegoods.com/cdn/shop/files/2024-09-29_23-34-29_B_R8_S4_STRAW_1x1_afa5b9c3-5e2c-4d49-9128-d835dd668561_1000x.jpg?v=1728025786" alt="Image">
182 </div>
183
184 <div class="item_text">1) scoop 8g of Rainbow Dust</div>
185 </div>
186
187 <div class="section_item" data-flavor="Strawberry" style="display: none;">
188 <div class="item_image">
189 <img src="//spacegoods.com/cdn/shop/files/2024-09-29_23-40-27_B_R8_S4_H_1x1_fd662ce0-7b5d-4bc4-ab80-a1b5b0223f61_1000x.jpg?v=1728026391" alt="Image">
190 </div>
191
192 <div class="item_text">2) mix with water or milk - cold like a milkshake!</div>
193 </div>
194
195 <div class="section_item" data-flavor="Strawberry" style="display: none;">
196 <div class="item_image">
197 <img src="//spacegoods.com/cdn/shop/files/SCC00590_1x1_693f2342-210b-469b-adb5-8a83ce860c61_1000x.jpg?v=1728026452" alt="Image">
198 </div>
199
200 <div class="item_text">3) use your frother to blend to perfection</div>
201 </div>
202
203 <div class="section_item" data-flavor="Strawberry" style="display: none;">
204 <div class="item_image">
205 <img src="//spacegoods.com/cdn/shop/files/SCC00881_1x1_95d55eac-482a-4826-b77b-bdfe6a33a377_1000x.jpg?v=1728026013" alt="Image">
206 </div>
207
208 <div class="item_text">4) drink &amp; enjoy focus - energy - calm</div>
209 </div>
210
211 <div class="section_item" data-flavor="Raw Chocolate (Decaf)" style="display: none;">
212 <div class="item_image">
213 <img src="//spacegoods.com/cdn/shop/files/2024-09-29_23-33-40_B_R8_S4_CHOC_1x1_d6c6c5d8-e0b7-4203-bb59-a2063ca9b251_1000x.jpg?v=1728025685" alt="Image">
214 </div>
215
216 <div class="item_text">1) scoop 8g of Rainbow Dust</div>
217 </div>
218
219 <div class="section_item" data-flavor="Raw Chocolate (Decaf)" style="display: none;">
220 <div class="item_image">
221 <img src="//spacegoods.com/cdn/shop/files/mix_2_2e82c99b-f91c-437a-a68e-12ddc274715d_1000x.webp?v=1723624267" alt="Image">
222 </div>
223
224 <div class="item_text">2) mix with water or milk - hot or cold</div>
225 </div>
226
227 <div class="section_item" data-flavor="Raw Chocolate (Decaf)" style="display: none;">
228 <div class="item_image">
229 <img src="//spacegoods.com/cdn/shop/files/frother_3_3e370a78-3b68-4974-a163-d46c4e89d657_1000x.webp?v=1723624287" alt="Image">
230 </div>
231
232 <div class="item_text">3) use your frother to blend to perfection</div>
233 </div>
234
235 <div class="section_item" data-flavor="Raw Chocolate (Decaf)" style="display: none;">
236 <div class="item_image">
237 <img src="//spacegoods.com/cdn/shop/files/SCC00936_1x1_77b9b3d3-2afe-4964-b522-e4aa8d233d06_1000x.jpg?v=1728025943" alt="Image">
238 </div>
239
240 <div class="item_text">4) drink &amp; enjoy focus - energy - calm</div>
241 </div>
242
243 </div>
244 </div>
245</div>
246<script>
247
248</script>
249
250
251</div>

How to install How to use v3 on your Shopify theme

This snippet belongs in sections/main-product.liquid (or any section where you want it to appear), in the block of your template where it makes the most contextual sense. Expect the whole job to take about 5–10 minutes.

  1. 1From your Shopify admin, open Online Store → Themes, click the button on your live theme and choose Duplicate. Always work on a copy so you can roll back instantly.
  2. 2On the duplicated theme, click … → Edit code to open the theme code editor.
  3. 3Open sections/main-product.liquid (or any section where you want it to appear) in the file tree. If your theme uses different file names, search for the template that renders the area where you want the block to show up.
  4. 4Click Copy code on this page, then paste the snippet in the block of your template where it makes the most contextual sense.
  5. 5The snippet ships with its own scoped <style> block, so you do not need to touch base.css or theme.css. If you prefer to keep CSS centralised, move the contents of the style tag into your theme stylesheet and delete the inline block.
  6. 6Keep the <script> tag at the end of the snippet. It only runs once the surrounding markup exists in the DOM, so moving it higher up the file can break the behaviour.
  7. 7Click Save, then hit Preview and check the block on desktop, tablet and mobile widths.
  8. 8When you are happy with the result, publish the duplicated theme from Online Store → Themes → Actions → Publish.

How to customise it

Every value below lives inside the snippet, so you can adapt How to use v3 to your brand without touching the rest of the theme.

  • Colours — the snippet uses #000001, #000, #2d2d2d. Replace those values inside the style block with your brand palette, keeping at least a 4.5:1 contrast ratio between text and background so the block stays accessible.
  • Sizing — adjust the font-size values (30px, 16px, 15px) and the padding so the block carries the same visual weight as the elements around it.
  • Cornersborder-radius: 8px controls the roundness. Set it to 0 for a sharper editorial look, or increase it for a softer, app-like feel.
  • Images — replace the placeholder image URLs with your own assets. Upload them under Content → Files in Shopify admin and use the generated CDN URL, or reference a theme asset with {{ 'my-image.png' | asset_url }}.
  • Copy — rewrite the hard-coded text (for example “How to use!”) in your own brand voice, and translate it if you sell in more than one language.
  • Responsive behaviour — the @media query defines the mobile breakpoint. Adjust the pixel value if your theme uses a different breakpoint scale.

Common mistakes to avoid

These are the issues merchants run into most often when installing a snippet like this one.

  • Editing the live theme directly. Duplicate it first — a single unbalanced Liquid tag can take a storefront down mid-campaign.
  • Pasting the code into the wrong file. Dropped into layout/theme.liquid instead of sections/main-product.liquid, this block will render on every page of the store, including ones where it makes no sense.
  • Renaming the CSS classes in the markup but not in the style block, or vice versa. The class names have to match exactly or the styling silently disappears.
  • Adding the snippet twice on the same page. The script targets its selector, so two copies can conflict or double-fire.
  • Publishing without testing on a real phone. Most Shopify traffic is mobile, and layout problems almost always surface there first.

Performance notes

What this block costs you in load time, and how to keep that cost at zero.

  • The CSS is inline and scoped to this block, so it adds no extra network request. At a few kilobytes it has no measurable effect on your Lighthouse score.
  • The JavaScript is vanilla — no jQuery, no external library, no additional request. Keep it after the markup so it never blocks rendering.
  • Add loading="lazy" plus explicit width and height attributes to every image in the snippet. That prevents Cumulative Layout Shift, which is a Core Web Vitals ranking factor.
  • Run PageSpeed Insights before and after you add the block so you have a concrete number rather than a guess.

SEO & accessibility

How to add this block without damaging your on-page structure or your rich results.

  • Nothing in this snippet should replace your page <h1>. Keep product and page headings intact and use <h2> or <h3> for the block's own heading so the document outline stays clean.
  • Write a descriptive alt attribute for every image. Empty or generic alt text is one of the most common accessibility and SEO issues on Shopify stores.
  • If the block shows review or rating content, keep it consistent with the structured data your review app already outputs. Duplicating or contradicting rating markup can cost you the rich result entirely.
  • The block does not create a new URL, so there is no canonical or indexing change to make. It improves on-page engagement signals rather than crawlability.
Frequently asked questions

How to use v3 — questions merchants ask

Will this snippet work with my theme?

It is built with standard Liquid, HTML and CSS, so it works with Dawn and virtually every Online Store 2.0 theme, as well as most vintage themes. The only thing that changes between themes is the file you paste it into — if yours has no sections/main-product.liquid, look for the equivalent template that renders the same area.

Do I need an app to use it?

No. This is theme code you own outright: no monthly fee, no third-party script tag, and no app that can break your storefront the next time it updates.

How long does it take to add “How to use v3” to a store?

Most merchants have it live in under fifteen minutes — duplicate the theme, paste the code, adjust the colours and copy, preview on mobile, publish.

The block appears but nothing happens. What is wrong?

That is almost always a script-order problem. Check that the script tag is still at the bottom of the snippet and that the markup was not pasted inside another script or a Liquid comment block. Open your browser console and look for an error naming the snippet's selector.

The styling looks broken after pasting. How do I fix it?

Confirm you copied the whole snippet including the closing style tag, then check whether one of your theme's own CSS rules is overriding it. If a theme rule wins, increase the specificity of the snippet's selector rather than scattering !important through the file.

Will it slow my store down?

Not meaningfully. It is inline markup with scoped CSS and at most a few lines of vanilla JavaScript — no external libraries, no extra HTTP request. Optimising your product images will always have a far bigger impact on load time.

Can I use it on a client store or a commercial project?

Yes. Every snippet in the MCO Hub library is free to copy, modify and ship on any store, including client work. Attribution is appreciated but not required.

Related snippets

Keep exploring