Liquid, JavaScript, themes, sales channels
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>
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?
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.
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 😕
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!
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 😕
Thats a pity, thanks for your time anyway
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:
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.
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/
Hi @PadraigCahill , do you mind sharing who you used on StoreTasker for this? Thanks! 🙏🏼
App Selly can help you offer discount for specific customer groups:
https://apps.shopify.com/selly
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
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024