App reviews, troubleshooting, and recommendations
Hello
I am working on building a theme for my client. The store has lots of discount codes across different products which are applicable to all the customers unconditionally. The requirement here is to show the discount codes applicable for a specific product on the product page, or atleast in a seperate offers page.
Is there any way to get the applicable discount codes for a products within the theme?
Thanks
@joshrau thank you for the feedback! We'll add these features in future releases.
good day, can we apply different discount codes for different products separately?
Hey, right now you can apply discount codes to all products. Different discount codes can be created - but one and the same customer cannot apply two discount codes at once.
hi!
Did you ever get a solution for this? I am looking for the same thing.
thanks!
no solutions whatsoever, still looking
Obviously it would be super great to have a built-in checkbox in the product page admin to hide / show the discount code on product pages.
The below solution is some-what involved, but once everything is set up, you'll be smooth sailing with dynamic discount codes on product pages and no app required.
Here's what I did:
Step 1: Create Discount Code
Take note of the name, you will use it in step 2. For this example, we will call the discount code COOL5 and it will offer 5% off a collection. Pause.. Open a new tab and lets create a collection
Step 2: Create a Collection
The title of your collection is going to be very very important. The title of my collection for the discount I just created will be: DISCOUNT-COOL5-5%.
The structure of this title is: DISCOUNT-{discount_name}-{discount_amount} where discount_name and discount_amount should match the discount you're creating.
Save this collection as a manual collection, and then add any products you want (our Discount Code in step 1 will apply to these). Also, this tripped me up for a hot second, but make sure this collection is available in at least the Store Sales Channel. I know, it sucks - this solution isn't perfect. If you don't do this the code we add in step 3 won't work since I guess collections have to be on a sales channel to appear in the collections liquid object.
Anyway, Go back to the Discount Code you were just creating in step 1 and select "Specific collections" in the "Applies To" section and select this collection you just created.
Step 3: Edit the code
This is something you only do once and it is well worth it.
Navigate to product-template.liquid by going to Online Store > Actions > Edit Code. On the left hand side search for "product-template".
Paste the below code where ever you'd like your discount code to appear on your product page and save:
{% for collection in product.collections %}
{% if collection.title contains "DISCOUNT" %}
{% assign parts = collection.title | split: "-" %}
{% capture discount_name %}{{ parts[1] }}{% endcapture %}
{% capture discount_amount %}{{ parts[2] }}{% endcapture %}
{% endif %}
{% endfor %}
{% if discount_name != blank and discount_amount != blank %}
<p>Use code {{ discount_name }} for an instant {{ discount_amount }} off!</p>
{% endif %}
For those interested, all this code does is loop over the product's associated collections, finds the collection where DISCOUNT is in the title and then stashes the name / amount in a variable, which you can do whatever you want with. And now you can tell why the naming is incredibly important.
Once this code is added, now your job is to just create Discount Codes and Collections as you normally would, with just a bit more attention to how things are named.
Here's a visual of the end result. I chose to place mine right under the price. The discount values you see here can all be changed by simply editing collection / discount titles.
Again, would way rather have a checkbox on the product page admin that toggled all this stuff - it'd be way cleaner, but this will do for me just fine. hit me up if you got questions.
Hi everyone,
Thanks for being informative and adding constructive feedback in this thread. While this is currently not something that can be done in the theme directly, it might be possible with the Storefront API (which is what Apps use). But it means you would have to build an app.
Another possible workaround is when you click on the code and it adds you. Which technically is possible in code, you can create a cart URL with the discount code. But you’d have to manually do that for each product, which is the pain point.
In saying all this, there is a feature request for this, where I have added all the feedback from this thread to it but currently there is no update and I am unable to give any timelines for it.
To learn more visit the Shopify Help Center or the Community Blog.
Thanks Nick,
Hopefully with the deployment of 2.0 we will see increased focus on value add for consumers.
Thanks
Chris
I cant believe that there is no app for this simple yet very powerful feature. On Shopify app store , there are literally thousands of apps for similar kind of features, yet there is no app for this kind of function . Below is another non Shopify store with this feature , Its in another language but , you can understand the feature. It shows how much the final price will be at the checkout (green price) .It says %25 off for purchases over $300. and since the product qualify for the discount , it shows the price in green.
This feature make customer feel like they score a nice additional discount and encourage them to complete the purchase. Of course you can directly apply the discount but it wouldn't give the excitement of scoring a deal.
I've spent several days searching for something to do this as well but still no updates?
A few people have mentioned they don't want to pay for a plugin to achieve this - I've struggled to even find a paid plugin that does it? Can someone please list them?
The suggested product from "Bold" does not achieve this - it simply discounts a product without any coupons.
I have tinkered with the suggestion from @Ehorvat but unfortunately this is really limited. For example if you have AfterPay running, it won't calculate the correct repayments. There's only so many areas of the website I want to hack into to get this to work.
I can't believe Shopify still haven't added a checkbox for this.
Hello -
It's been four years and we have yet to find a solution. Someone come up with this so its already made in Shopify or on an app. 😞 Something so simple yet so complicated to have.
Its crazy it isn't a feature yet 😞
Hey folks! I think I may have a workaround for this request 🙂
It would be possible to display each individual discount code on the product page by using metafields. The general process would be to assign the discount code as a metafield value to each individual product, and then use the metafield Liquid object to output the unique value/ discount code on each product page.
If you use this approach however, it’s important to remember that if a product’s discount code is changed, you’d need to manually update the discount metafield on the product level.
Here’s a description of the process:
{% if product.metafields.custom.discount != blank %}
<p>Use this discount for 30% off: {{ product.metafields.custom.discount }}</p>
{% endif %}
Hope this solution helps! You could also customize the look and feel with CSS, and potentially build this as its own block element. It would also be a great idea for an app developer to build this logic and workflow into an app!!
Cheers,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
I want to offer a solution!
I was able to set a % or fixed discount from the DISCOUNT section in Shopify Admin. You can apply this to 1 or as many collections as need more. You could also apply this to specific products individually I think. Title the discount name with the % or fixed amount you want to offer, this way you can keep track of what it is used for.
Next, I added tags to the associated products you want to discount, you can do this in bulk by filtering by collection in the PRODUCTS section. The tags could be DISOUNT-5% or similar.
Then on the products page you can add logic, IF PRODUCT.TAGS CONTAIN DISCOUNT-5% THEN... add your logic to display discounts. I simply did the current price * percent discount to output my results. See below!
Here is my output that I came up with:
Please reach out if you want any other help on this or have any suggestions/ recommendations!
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023