Custom Pricing Based on Customer Tag

PadraigCahill
Shopify Partner
6 0 2

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>

Replies 14 (14)

SobefyOscar
Shopify Partner
115 11 41

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: oscar@sobefy.com
Website: Sobefy.com
PadraigCahill
Shopify Partner
6 0 2

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.

SobefyOscar
Shopify Partner
115 11 41

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: oscar@sobefy.com
Website: Sobefy.com
PadraigCahill
Shopify Partner
6 0 2

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!

SobefyOscar
Shopify Partner
115 11 41

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: oscar@sobefy.com
Website: Sobefy.com
PadraigCahill
Shopify Partner
6 0 2

Thats a pity, thanks for your time anyway

cmartinez89
Shopify Partner
112 10 35

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.
PadraigCahill
Shopify Partner
6 0 2

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/

jessica90
Shopify Partner
1 0 0

Hi @PadraigCahill , do you mind sharing who you used on StoreTasker for this? Thanks! 🙏🏼

HadyK
Tourist
3 0 4
I watched the video
Interesting solution but the only problem is he duplicated the product and both retail version and wholesale version don't share the same inventory count.
In my case that could be problematic as my wholesale customer could login and purchase all the pieces per a model and it wont show on the retail side that it is out of stock

Any solution?
Risa
Shopify Partner
328 16 39

@HadyK 

 

App Selly can help you offer discount for specific customer groups:

 

https://apps.shopify.com/selly

★ SELLY UNITED - The front solution to increase sales for online store and POS - https://apps.shopify.com/selly
HadyK
Tourist
3 0 4
Thanks
Will check it out
greiseve
Explorer
63 1 83

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 

Ram_A
Explorer
60 3 19

Hi @PadraigCahill , plz share who you used on StoreTasker for this? thnx