Custom Pricing Based on Customer Tag

New Member
6 0 0

Hi,

 

I am trying to edit the product prices on a store based on a customer tag to allow 20% off for customers tagged "Trade". I want a coded solution as opposed to an app.

 

I have tried the code below on the product-template.liquid page but it isn't working.

 

Can anyone please tell me where I am going wrong.


<ul class="inline-list product-meta">
<li> <span id="productPrice-{{ section.id }}" class="h1">

{% if customer.tags contains 'Trade' %}
{{ variant.price | divided_by: 100 | times:80 }}

{% else %}

{% include 'price' with variant.price %}

{% endif %}
</span>
</li>

{% if product.compare_at_price_max > product.price and section.settings.product_show_saved_amount %}

<li>
<span id="comparePrice-{{ section.id }}" class="sale-tag large">
{% assign compare_price = variant.compare_at_price %}
{% assign product_price = variant.price %}
{% include 'price-sale' %}
</span>
</li>
{% endif %}
{% if section.settings.product_reviews_enable %}
<li class="product-meta--review">
<span class="shopify-product-reviews-badge" data-id="{{ product.id }}"></span>
</li>
{% endif %}
</ul>

0 Likes

Your best bet is to go to your customer panel and do a search, then save that search into a new group. You can create discounts that apply only to a specific group of customers. This will save you having to code, also this approach only changes the price on product page, but not on checkout as Shopify will still reference the price from the actual product listing, not from your product page. 

 

Make sense? 

Want to customize or make changes to a theme? Hire me.
If my answer was helpful please Like and Accept Solution.
Email: oscardiazserrat@gmail.com
Behance: behance.net/starseedscreative
1 Like
New Member
6 0 0

Thanks Oscar,

 

But I want the discount to be seen on the product and collection pages once the customer is logged in.

 

Not sure you're suggested approach does that and it would still requires a discount code to be added at checkout.

 

Pit the automatic discount option can't be applied to a customer group like teh discount codes can.

0 Likes

Gotcha! Have you tried Bold Customer Pricing App? https://apps.shopify.com/customer-pricing?ref=shappify&utm_campaign=community&utm_medium=social&utm_... 

 

Looks like it does exactly what you are looking to do. Or if you are familiar with Shopify's API you can create a custom app, but via the theme I'm afraid it's not possible :/

 

 

Want to customize or make changes to a theme? Hire me.
If my answer was helpful please Like and Accept Solution.
Email: oscardiazserrat@gmail.com
Behance: behance.net/starseedscreative
0 Likes
New Member
6 0 0

It does yes but the pricing system is a little bit more expensive than i would like and I always like to learn some new coding solutions .... if possible!

0 Likes

Gotcha! Yeah I'm afraid you won't be able to affect any price changes by tweaking the theme's code because that data is not really theme dependent :/ you might need an app, or custom app :/

Want to customize or make changes to a theme? Hire me.
If my answer was helpful please Like and Accept Solution.
Email: oscardiazserrat@gmail.com
Behance: behance.net/starseedscreative
0 Likes
New Member
6 0 0

Thats a pity, thanks for your time anyway

0 Likes
Shopify Partner
111 9 22

Hey there, it's possible. I do this all the time. You want to code a custom wholesale channel. Be sure to create a backup and follow this tutorial: 

 

https://www.envision.io/blogs/ecommerce-pulse/80312001-how-to-add-a-wholesale-area-to-your-shopify-s...

 

Of course in your case, it's 'trade', but the concept is the same. You want special prices for customers tagged 'trade'. It's very effective, however you'll likely need tweaking in order to polish it. It helps to understand shopify's control flow tags for links, banners, etc based on whether a customer is tagged 'trade' or not. You can also do more advanced things like show invoices column in customer account page for certain customers. This way, they can log in and print out any invoice they need. Try it out, don't give up! Here to help anytime.

I am a multi-disciplined web developer with years of experience working with several languages and frameworks.
0 Likes
New Member
6 0 0

Hi @cmartinez89 thanks for that. I have used a similar process to that before but was hoping for a more streamlined process this time around.

 

I did get sorted in the end though thanks to assistance from someone at https://storetasker.com/ . Great service at a very reasonable price. I can see the code he used and it was fairly complex so wouldn't have gotten it sorted myself, but at least I'll have it again if needed. I also used some code from an article at this link https://wearetmbr.com/shopify-auto-fill-discount-code-on-checkout-page/

0 Likes
Highlighted
Excursionist
23 1 3

Hi Oscar,

 

I'm looking for an easy solution to automatically giving a certain group of customers (dealers) a certain discount.

 

I understand the grouping of customers, and I also know how to create a customer discount code (DEALER) that only they can use... 

 

however is there a way to auto-populate the discount field and apply the discount automatically at check out? see the last answer, I followed the link at it doesn't seem to automatically apply the discount. still need to click APPLY.

 

secondly, I'm very intrigued by your comment about showing pricing on the product page with discount. do you mean on the actual individual product page or at the check out?

 

thanks,

Evert 

0 Likes