The Macgi Shopify app is in the works. Meanwhile you can use the widget today with one script tag in your theme.
Shopify app (coming soon)
The app will install from the Shopify App Store, add the “Try it on” button as a theme app block without code, and let you turn it on per product. Stores in the beta hear as soon as it is ready. When you switch to the app, just remove the script tag you added below.
Interim 1: the script in theme.liquid
- In the Shopify admin, go to Online Store → Themes.
- On your live theme, click ⋯ and choose Edit code.
- In the layout folder, open
theme.liquid. Find the
</body>tag and paste this just above it:<script src="https://cdn.macgi.app/widget.js" data-key="pk_live_..." data-auto defer></script>- Click Save, then open a product page and look for the “Try it on” button.
Shopify themes already output product data and an og:image, so auto mode usually finds the right page and photo. To have trousers and dresses tried on correctly, add data-slot-rules (see the Quick start).
Interim 2: place the button with a Custom Liquid block
No theme code to edit beyond the script tag, and you can drag the button exactly where you want it on the product page.
Add the script tag to
theme.liquidas in interim 1, but withoutdata-auto:<script src="https://cdn.macgi.app/widget.js" data-key="pk_live_..." defer></script>- Go to Online Store → Themes → Customize and open the Products → Default product template.
- In the product information section, click Add block → Custom Liquid and drag it below the “Add to cart” button.
Paste this into the block’s Liquid box:
<button type="button" class="button button--secondary button--full-width" data-macgi-tryon data-garment-image="{{ product.featured_image | image_url: width: 1200 }}" data-garment-slot="{% if product.tags contains 'macgi-bottom' %}bottom{% elsif product.tags contains 'macgi-one-piece' %}one_piece{% else %}top{% endif %}" data-garment-description="{{ product.title | escape }}"> Try it on </button>Tag trousers and skirts with
macgi-bottom, dresses withmacgi-one-piece. Theimage_urlfilter returns a URL starting with//; the widget understands it, so there is no need to addhttps:. Adjust the button classes to your theme.- Click Save.
Many Online Store 2.0 themes, such as Dawn, include a Custom Liquid block. If yours does not, paste the button into the product section file (often sections/main-product.liquid) right after the add-to-cart button.
Notes
- Domains: give us both your own domain and your
.myshopify.comdomain when you sign up. - Switching themes: the script lives in the theme, so paste it into the new theme before you publish it.
- Options, JavaScript events and troubleshooting: see the Quick start.
Need a hand?
During the beta we install it with you over Zalo or email, free of charge.