Shopify Article Product Card
Note: this has only been tested with custom themes that mirror Dawn's architecture. You can customize the templates to work with your theme.
Installation
- Add
article-product-card.js
to yourassets
theme folder - Open
sections/main-article.liquid
and add the following code at the top:
<script src="{{ 'blog-product-card.js' | asset_url }}" defer></script>
- You may also need to add the following code at the top of your
main-article.liquid
file as well to include product card and price styles:
{{ 'component-card.css' | asset_url | stylesheet_tag }}
{{ 'component-price.css' | asset_url | stylesheet_tag }}
Usage
- Find the product handle of the product you'd like to embed in your article (e.g.
awesome-product
) - Switch the editor to HTML view
- Paste in the
article-product-card
code:
<article-product-card handle="awesome-product"></article-product-card>
- When rendered, this will be replaced with a product.
Options
You may also include show-price="true/false"
and show-vendor="true/false"
attributes to turn those options on/off