-- product in all-products
{% for product in collections.all-products.products %}
{{ product.title }}
<ul>
<li>{{ variant.image.src }} - Variant Image Object</li>
<li>{{ variant.price }} - Variant Price</li>
| Demo: https://stone-digital-test.myshopify.com/pages/tag-loop-example | |
| <!-- Step 1) create comprehensive list of all tags ie. tags_list --> | |
| {% capture tags_list %} | |
| {% for product in collections.all-products.products %} | |
| {% for tag in product.tags %} | |
| {{ tag | strip | strip_newlines }}{% if forloop.last == true %}{% else %},{% endif %} | |
| {% endfor %}{% if forloop.last == true %}{% else %},{% endif %} | |
| {% endfor %} | |
| {% endcapture %} |
| UTF-16 | UTF-8 | DESCRIPTION | SAMPLE |
|---|---|---|---|
| \U0022 | \x22 | QUOTATION MARK | " |
| \U0027 | \x27 | APOSTROPHE | ' |
| \U201C | \xe2\x80\x9c | LEFT DOUBLE QUOTE | “ |
| \U201D | \xe2\x80\x9d | RIGHT DOUBLE QUOTE | ” |
| \U2018 | \xe2\x80\x98 | LEFT SINGLE QUOTE | ‘ |
| \U2019 | \xe2\x80\x99 | RIGHT SINGLE QUOTE | ’ |
| \u002d | \x2d | A HYPHEN | - |
| \u2013 | \xe2\x80\x93 | AN EN DASH | – |
| Array( | |
| [key] => b2518060b99e87b333629133e91ee828 | |
| [product_id] => 57317 | |
| [variation_id] => 0 | |
| [variation] => Array | |
| ( | |
| ) | |
| [quantity] => 1 | |
| [data_hash] => b5c1d5ca8bae6d4896cf1807cdf763f0 | |
| [line_tax_data] => Array |
| Array( | |
| [key] => ############################ | |
| [product_id] => 57317 | |
| [variation_id] => 0 | |
| [variation] => Array() | |
| [quantity] => 1 | |
| [data_hash] => ########################## | |
| [line_tax_data] => Array( | |
| [subtotal] => Array() | |
| [total] => Array() |
| // this is to create a Nested Array | |
| // eg. multiLevelArray[0][0] | |
| var multiLevelArray = new Array(loop.length); | |
| for (var k = 0; k < loop.length; k++) { | |
| multiLevelArray[k] = new Array(loop[k].valueA, loop[k].valueB); | |
| } |
| <div class="grid-container"> | |
| {% for collection in collections %} | |
| <div class="grid-item"> | |
| <div class="grid-item-photo"> | |
| <a href="{{ collection.url }}"> | |
| {% for image in collection.images limit:1 %}<img src="{{ image }}" alt="{{ image.alt | escape }}">{% endfor %} | |
| </a> | |
| </div> | |
| <div class="grid-item-title"> | |
| <a href="{{ collection.url }}">{{ collection.title }}</a> |
| Weird Character => True Character | |
| ’ => ' | |
| ’ => ' | |
| ‘ => ' | |
| ‚Äã => nothing | |
| ‚Äã => nothing | |
| ‚Ķ => … | |
| • => - | |
| ‚Äê => - | |
| -­ => - |
| <?php | |
| /** | |
| * Pre-populate Woocommerce checkout fields | |
| * Note that this filter populates shipping_ and billing_ fields with a different meta field eg 'first_name' | |
| */ | |
| add_filter('woocommerce_checkout_get_value', function($input, $key ) { | |
| if($key == 'billing_first_name') { | |
| return 'NEW FIRST NAME'; | |
| } | |
| if($key == 'billing_last_name') { |
| <?php | |
| $product = wc_get_product($product_id); | |
| if( $product->is_on_sale() ) { | |
| $discount = $product->get_regular_price() - $product->get_sale_price(); | |
| } | |
| else { | |
| $discount = 0; | |
| } | |
| ?> |