I created a Metafeild tag on all products with a drop-down to choose “Next day Shipping” or "Standard shipping.
I then have some custom Javascript, HTML and CSS where I want to display different countdowns for shipment depending on whether the products have next-day or standard.
Is it possible to do this?
Hey Alice!
Absolutely that is something you can do. As you have create the counter code, I will presume that you have dev experience.
On the product template, you can check to the products metafield value, and render the intended code.
For example:
{% assign shipping_method = product.metafields.YOUR_NAMESPACE.YOUR_KEY.value %}
{% case shipping_method %}
{% when STANDARD_VALUE %}
//Standard shipping code
{% when NEXT_DAT_VALUE %}
//Next day shipping code
{% else %}
//Default if no value is selected
{% endcase %}
Here is the docs for working with metafields in liquid.
Let me know how that goes!
Hello, Thank you so much for responding! It’s my first proper try with JS. I’ve tried something using the same format but can’t quite get it to work.
Next day Delivery
All Travel Systems, Strollers and Car seats are shipped Free Next day delivery.
To qualify for UK Next Day Delivery, all you need to do, is order on the Ickle Bubba website before 2pm, Monday-Thursday.
Orders placed after 2pm will be shipped next day with next day shipping.
Any orders placed from Friday to Sunday will be shipped Monday with a delivery date of the Tuesday.
Standard Delivery
All Furniture, Spares, Accessories, and Nursery Items will be shipped as standard delivery.
On the Ickle Bubba website orders placed before 2pm, Monday-Thursday will be shipped same day, with 2-3 day shipment time.
Any orders places after 2pm will be shipped next day with 2-3 day shipment time.
Any orders placed from Friday to Sunday will be shipping Monday with a 2-3 days shipment time.
(function( jQuery ){
{% assign shipping_method = product.metafields.custom.shipping_method.value %}
{% case shipping_method %}
{% when Standard Delivery %}
document.getElementsByClassName('standard')[0].style.display = 'block';
document.getElementsByClassName('next_day')[0].style.display = 'none';
{% when Next Day Delivery %}
document.getElementsByClassName('standard')[0].style.display = 'none';
document.getElementsByClassName('next_day')[0].style.display = 'block';
{% else %}
//Default if no value is selected
{% endcase %}
})( window.GemQuery || jQuery );