File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ This is a list of useful Shopify Snippets that I often reference while developin
10
10
* [ Back or Continue Shopping link on Cart] ( #back-or-continue-shopping-link-on-cart )
11
11
* [ Add Class or Id to Form] ( #add-class-or-id-to-form )
12
12
* [ Add Custom Badge on Products using product tag] ( #add-custom-badge-on-products-using-product-tag )
13
+ * [ Add On Sale Badge on Products Based on Price] ( #add-on-sale-badge-on-products-based-on-price )
13
14
* [ Insert Block inside a for loop at any position] ( #insert-block-inside-a-for-loop-at-any-position )
14
15
15
16
@@ -100,6 +101,15 @@ This code adds a limited badge on products with "limited" tag on them. Add this
100
101
{% endfor %}
101
102
```
102
103
104
+ ## Add On Sale Badge on Products Based on Price
105
+ * Products must have "Compare at price" field fill in admin.
106
+ * Shows Badge when "compare_at_price_max" > "product price"
107
+ ``` html
108
+ {% if product.compare_at_price_max > product.price %}
109
+ <img class =" sale-product" src =" {{ 'sale-badge.png' | asset_url }}" alt =" On Sale Badge" >
110
+ {% endif %}
111
+ ```
112
+
103
113
## Insert Block inside a for loop at any position
104
114
This code inserts "new-block" div at position 4.
105
115
``` html
You can’t perform that action at this time.
0 commit comments