Skip to content

Commit f047009

Browse files
authored
add "call product object on any page" snippet
1 parent 8e74b87 commit f047009

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is a list of useful Shopify Snippets that I often reference while developin
88
* [Add On Sale Badge on Products Based on Price](#add-on-sale-badge-on-products-based-on-price)
99
* [Back or Continue Shopping link on Cart](#back-or-continue-shopping-link-on-cart)
1010
* [Calculate Discount on Products](#calculate-discount-on-products)
11+
* [Call a Product on any page](#call-a-product-on-any-page)
1112
* [Display Articles in a Blog](#display-articles-in-a-blog)
1213
* [Display Links in a Linklist](#display-links-in-a-linklist)
1314
* [Display Products in a Collection](#display-products-in-a-collection)
@@ -67,6 +68,12 @@ Inset the following code inside items loop in cart template.
6768
<span class="discount">OFF: {{ discount }}</span>
6869
```
6970

71+
## Call a Product on any page
72+
```html
73+
{%- assign product = all_products['product-handle'] -%}
74+
```
75+
Then do anything with product object like ```{{ product.title }}```
76+
7077
## Display Articles in a Blog
7178
```html
7279
{% for article in blogs.blog-name.articles limit:1 %}

0 commit comments

Comments
 (0)