File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ This is a list of useful Shopify Snippets that I often reference while developin
22
22
* [ Recommend related products] ( https://help.shopify.com/themes/customization/products/recommend-related-products )
23
23
* [ Show More Products from a Vendor] ( #show-more-products-from-a-vendor )
24
24
* [ Strip empty tags from article excerpt] ( #strip-empty-tags-from-article-excerpt )
25
+ * [ Multiple currency selector] ( #multiple-currency-selector )
25
26
26
27
## Add Custom Badge on Products using product tag
27
28
This code adds a limited badge on products with "limited" tag on them. Add this in product template.
@@ -214,6 +215,36 @@ Strip out empty p and span tags
214
215
{{ article.excerpt | strip_html }}
215
216
```
216
217
218
+ ## Multiple currency selector
219
+
220
+ ``` liquid
221
+ {% form 'currency' %}
222
+ {{ form | currency_selector }}
223
+ {% endform %}
224
+ ```
225
+
226
+ ``` liquid
227
+ {% form 'currency' %}
228
+ <select name="currency">
229
+ {% for currency in shop.enabled_currencies %}
230
+ {% if currency == cart.currency %}
231
+ <option selected="true" value="{{ currency.iso_code }}">{{currency.iso_code}} {{currency.symbol}}</option>
232
+ {% else %}
233
+ <option value="{{ currency.iso_code }}">{{currency.iso_code}} {{currency.symbol}}</option>
234
+ {% endif %}
235
+ {% endfor %}
236
+ </select>
237
+ {% endform %}
238
+ ```
239
+
240
+ ``` js
241
+ $ (' .shopify-currency-form select' ).on (' change' , function () {
242
+ $ (this )
243
+ .parents (' form' )
244
+ .submit ();
245
+ });
246
+ ```
247
+
217
248
## License
218
249
219
250
Licensed under the [ MIT] ( https://github.com/vikrantnegi/shopify-code-snippets/blob/master/LICENSE ) .
You can’t perform that action at this time.
0 commit comments