Showing discount on Product Page (without Compare price)

Solved
Highlighted
Tourist
9 1 1

Hey,

I have created an Automatic Discount that applies to a specific Collection. The discount rule is 40% on all products within that collection.

The discount is visible when i add the product to the cart and view it in the cart. But i am not able to figure out how to get the discount to show on the product page.

All the articles i have read seem to apply to products that have a different compare price.

Ex. https://www.blackbeltcommerce.com/shopify-how-to-show-percentage-discount-saved/

 

But i am not changing the compare price since i am using the Automatic Discount. Is there a way to do this? Or do i need an app?

1 Like
Highlighted

Hello 

Search this code:
<h3 class="h1 product-single__title">
Add below code after that:

{% if product.compare_at_price_max > product.price %}
{{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}% off
{% endif %}
Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
0 Likes
Highlighted
Tourist
9 1 1

Hey oscprofessional,


This doesn't work since i don't have Compare Price on the products. I am only using the Automatic Discount rule.

0 Likes

Success.

Shopify Expert
2686 67 688

Not 100% sure, but my understanding is that you (I mean your theme code) can't know what discounts apply until you add item to cart and only then this information is available, as not all discounts are as simple as yours.

With some hackish javascript your can do it in background and update the data displayed on the product page, but ...

 

In your case you may be better off by simply outputting the  {{ product.price | times: 0.6  | money }} (and so on) based on some condition?

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
Tourist
9 1 1

Hey Tim,

 

Yeah. That seems right. I am using the debut theme currently.

That seems like a really clever trick. How would i apply it only to a single collection though?

My guessing is something like this:

{{ if product.type == 'shoes' }}

code

{{ endif }}

 

But it seems like the built in discount system has it's limitations. Is there a recommended app for setting more advance discount?

Because changing the Compare Price on each product is not really an option when you have hundreds of products.

0 Likes
Highlighted
Shopify Expert
2686 67 688

Approximately:

{% if product.type == "shoes" %}
  {{ product.price | times: 0.6 | money }}
{% else %}
  {{ product.price | money }}
{% endif %}

However, if your products has variants, it's a bit more complex and will need javascript modification as well.

 

Shopify Discounts have limitations, but I see a reason why Auto discounts applied in cart only, because some may apply only if entire order is more than threshold. 

 

You may consider using an App, general automation app like Arigato or Mechanic, or some discount app.

Say, you can instruct the app to loop over products in particular collection and assign compare_at_price to be product.price * 1.4 :)

Sorry, I am not a good help when selecting a discount app.

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
Excursionist
11 0 2

Im running into the same situation. We run x% off collections/certain products/etc. 
Anyone know of (or willing to write) and app I can turn off and on that will read the active discounts using shopify discounts
I still can't believe this isnt a core feature (like it is on so many other carts)
The problem with editing the code alone is everytime we run a sale we'd have to edit the code, worse yet some of our products have up to 55 variations. 

0 Likes