Created
May 29, 2019 11:14
-
-
Save schappim/ba7d0313488ce7e451c3b7cdbc18cff2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 local_inv = product.variants.first.inventory_quantity %} | |
{% assign supplier_inv = product.metafields.inventory['supplier_inventory'] %} | |
{% if local_inv < 0 %} | |
{% assign local_inv = 0 %} | |
{% endif %} | |
{% if supplier_inv < 0 %} | |
{% assign supplier_inv = 0 %} | |
{% endif %} | |
{% assign total_available = supplier_inv | plus: local_inv %} | |
{% assign min_days = 86400 | times: 3 %} | |
{% assign max_days = 86400 | times: 5 %} | |
{% assign min_eta = "now" | date: "%s" | plus: min_days | date: "%b %d, %Y" %} | |
% assign max_eta = "now" | date: "%s" | plus: max_days | date: "%b %d, %Y" %} | |
{% if total_available > 0 %} | |
<div class="stock-availability"> | |
{% if product.variants.first.inventory_quantity > 0 %}<p class="local-inventory"> | |
We have <strong>{{product.variants.first.inventory_quantity}} units</strong> in our <strong>Sydney Warehouse</strong> available for immediate dispatch.<br/><br/> | |
</p>{% endif %} | |
{% if product.metafields.inventory['supplier_inventory'] > 0 %}<p class="supplier-inventory"> | |
We can get{% if product.variants.first.inventory_quantity > 0%} a further{% endif %} <strong>{{ product.metafields.inventory['supplier_inventory'] }} units</strong> in Australia from <strong>{{ product.vendor }}</strong>. If you order today, we can dispatch this stock between <strong><span class="supplier-dispatch-eta">{{min_eta}} - {{max_eta}}</span></strong>. | |
</p>{% endif %} | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment