Showing discount on Product Page (without Compare price)

Solved
Highlighted
Excursionist
14 1 7

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?

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
Whats app
Free Website Review and advice for sale from Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Shopify SEO ; Digital Marketing & amp | Site Speed Optimization | Performance Site Audit
Highlighted
Excursionist
14 1 7

Hey oscprofessional,


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

Highlighted
Shopify Expert
2684 67 846

This is an accepted solution.

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
Excursionist
14 1 7

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
2684 67 846

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
17 0 13

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
Highlighted
New Member
1 0 0

Thanks Its working fine but i want it in bold and in dark color.

 

Thanks!

0 Likes
Highlighted
New Member
1 0 0

Hello.

I know what you mean.

you can modify on the top of file(product-price.liquid)

Pay attention to this: {%- assign money_price = price | money -%}

You can define a new variable to store the price displayed after the discount

For example:
{%- assign New_money_price = price | times: 0.6 | money -%}  //the price you want to show.

You can visit my website(casefyi ), and that's how I do it.

 

0 Likes
Highlighted
New Member
9 0 0

same problem here

0 Likes