Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello,
We need to display a different price for customers with a specific customer tag. This is only to DISPLAY specific prices (there is no purchase capability on the site).
I was able to do this successfully with Liquid in the product-price.liquid file, and in the product-template.liquid file:
{% if customer.tags contains 'retail' %}
{{ current_variant.price | times: 2.5 | money }}
{% else %}
{{ current_variant.price | money }}
{% endif %}
However I'm running into a wall with Javascript. The issue is when the variant changes, it loads the updatePrice JS function which reverts the price shown back to the original price.
I added a new customer metafield called "retail" and I was trying to call it within the updatePrice function:
_updatePrice: function(evt) {
var variant = evt.variant;
var customer_type = customer.metafields.custom.retail.value;
if (customer_type == "retail") {
variant.price = variant.price * 2.5;
}
However it seems that any code I add to the updatePrice function causes the site to break, menu dropdowns no longer work, etc.
Not sure why this is happening, can someone help?
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025