Last active
March 15, 2019 15:25
-
-
Save carbone/70167921a16fd6238832730c37e26816 to your computer and use it in GitHub Desktop.
Use in combination with Mr. Arigato https://apps.shopify.com/mr-arigato-task-automator to show stock by location in a Shopify theme. See also: https://apps.bonify.io/mr-arigato-task-automator-for-shopify "Set Variant Inventory Level Metafield by Location ID (SKU required)"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign loc = shop.metafields.custom_fields["locations"] | split: "|" %} | |
{% if loc != blank %} | |
<h3>Available at the following locations</h3> | |
<table> | |
{% for info in loc %} | |
{% assign table_item = info | split: '='%} | |
{% assign location_id = table_item[0] %} | |
{% assign location_name = table_item[1] %} | |
<td colspan="2"><strong>{{ location_name }}</strong></td> | |
{% for variant in product.variants %} | |
{% if variant.metafields.inventory_levels[location_id] != blank %} | |
<tr> | |
<td>{{variant.title}}</td> | |
<td>{{ variant.metafields.inventory_levels[location_id] }} in stock</td> | |
</tr> | |
{% endif %} | |
{% endfor %} | |
{% endfor %} | |
</table> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment