All things Shopify and commerce
Hi,
I currently have our site set up to show the regular price to anybody who views a product, unless they are tagged in a certain way and then they are shown the compare at price. This worked in a way just to advertise our products, and the customer would then get in touch to enquire about it, but we now wish to allow ordering through the site and shopping cart.
Is there a way to pass the compare at price through just for these tagged customers so the cart and order don't show the regular price?
Many thanks.
Yes it's possible to show different variables on the product page.
Here's how:
1. Duplicate your theme so you can work off of a new theme without affecting the live site.
2. Find where the product price shows. For example, it could be in the Snippets folder in a file called price.liquid
3. Add the code to change / show what you want.
For example, if you want ot show the compare price instead of price to logged in visitors with a certain tag, you could do something like this (Liquid code):
{% if customer and customer.tags contains "Some Tag" %}
{{ product.compare_price_at_price }}
{% else %}
{{ product.price }}
{% endif %}
The exact code would depend no what you have already in your theme. I would just find where price shows, then use Liquid to only show compare price for those tagged customers.
Reference docs:
https://shopify.dev/docs/api/liquid/objects/product
https://shopify.dev/docs/api/liquid/objects/customer
Thanks for your reply. I think what you are talking about doing is how I already have it (on the product page a different price is shown dependant on the customer tag).
What I'm trying to achieve is when a product is added to the cart, the tagged customer receives the same price they view on the product page.
Currently they are shown the compare-at-price on the product page, but once I've added it to cart, they are seeing the regular price in the basket and checkout that none tagged customers see.
Oh I see. The price is determined on what you have in your database (the "price" field in the product page), you're not able to edit the database from the theme, nor would you want to, because then it would affect other customers by changing the price of the product.
Couple ideas:
a) Create a duplicate product, and show that product to those tagged users. Or if you don't want to show that new product anywhere, you can use the ajax API and then use that code snippet I gave you and programmatically add the item to the cart (so if the logged in customer clicks add to cart, you would have some custom code that adds the other product to the order, with the different price).
b) Create a discount for those customers. Well, since the price is greater, you may have to create a discount for everyone else, not tagged.
c) Write down your goal with this and brainstorm with your team on other ways to achieve the same result, without showing different prices to different people
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