Hi,
I got this to work for the Debut theme, if that’s a help.
I added this code to my product-template.liquid file (position it where you want the shipping information to appear):
{% capture ‘meta_data’ %}
{% for variant in product.variants %}
{{variant.id}}:{{ variant.metafields.shipping.time | json }}{% unless forloop.last %},{% endunless %}
{% endfor %}
{% endcapture %}
again you’ll need to change the naming for you metafields. Mine are variant.metafields.shipping.time
Then update the theme.js file. Find the Event handler for when a variant input changes part and add the lines in red below near the end.
/**
- Event handler for when a variant input changes.
*/
_onSelectChange: function() {
var variant = this._getVariantFromOptions();
this.$container.trigger({
type: ‘variantChange’,
variant: variant
});
if (!variant) {
return;
}
this._updateMasterSelect(variant);
this._updateImages(variant);
this._updatePrice(variant);
this._updateSKU(variant);
this.currentVariant = variant;
if (this.enableHistoryState) {
this._updateHistoryState(variant);
}
if (variant) {
var id = variant.id
shippingInfo(id);
}
},
That worked for me anyway, it’s based on the code from the other post above.