A space to discuss online store customization, theme development, and Liquid templating.
Hi,
I need to get the untranslated value of the product type in the liquid code. Before translating our store in other languages, we were using the product type as a condition of some of the features some of our product pages would display, which was working fine and would prevent us from relying too much on tags and metafields, which would clutter the interface at some point.
Is there a way to get the original, default value of a product field ? In the API, translations are their very own things, and while I get that in the theme you want a translated content by default, it seems very unpractical to me that we don't have a filter or another mean to get the base value.
I had to do a tricky way to get store default value of product through javascript fetching .json of store base language
{% assign full_url = request.origin | append: request.path | append: '.json?country=CH' %}
<script>
const url = '{{ full_url }}';
async function load() {
obj = await (await fetch(url)).json();
const price = obj.product.variants[0].price;
console.log(data);
}
}
load();
</script>
Hi Kazi,
Thank you for your answer. It could be a nice solution when you have a JS-first storefront, but ours is mainly liquid-generated and we want to keep it this way for now. Fetching the product informations one more time in the browser should not have to be done just to be able to access base values...