Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
We have a store that has some vue.js slapped in it and curious to know what is a better way to check against product tags in regards to store performance.
Example 1:
<script>
var checkProduct = false
{% if product.tags contains 'whatever' %}
var checkProduct = true
{% endif %}
</script>
Example 2:
Since we store product data on the vue model i can check against them with
<script>
if(product_data.tags.includes('whatever') {
vm.checkProduct = true
}
</script>
Is there any benefit in doing either way of the above in regards to performance?
If i put liquid inside of a script tag does it just convert it to it's js equivalent anyway when it renders? And if it does then it would mean that there's no real difference?
Thank you
Solved! Go to the solution
This is an accepted solution.
The version with liquid tags will put more processing on the server so the response of the can be marginally slower. When there's a lot of requests this can make a difference. Without doing any testing for speed between the two I'd choose the JavaScript option.
This is an accepted solution.
The version with liquid tags will put more processing on the server so the response of the can be marginally slower. When there's a lot of requests this can make a difference. Without doing any testing for speed between the two I'd choose the JavaScript option.
User | RANK |
---|---|
32 | |
28 | |
19 | |
9 | |
9 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By