Post by ninexus9 » Mon May 26, 2025 9:39 pm

Greetings, I'm using Opencart 4.1.0.3 on my local machine, and it seems when I set discount type to "Percentage" or "Subtract" for product the discount price is appearing correct for featured products but showing wrong price for products in "Special Products" section in homepage.
No third-party extension is installed I'm only using default Opencart modules like Featured & Specials which comes with default Opencart extension. In order to reproduce the issue please enable and use the both modules in the homepage layout.
Issue Details.
I have a product of ₹101.00 on which 20% discount is applied. In Featured Products section the displayed price of the product is ₹80.80 which is correct but in the Special Products section the price of the same product is ₹20.00 which is wrong. Please take a look at screenshots given below.

Screenshot - Featured Products.
Image

Screenshot - Special Products
Image

Steps to reproduce the issue.
  • Go to Catalog > Product via sidebar in Admin Dashboard.
  • Create a new product or edit an existing product.
  • Select the Discount tab.
  • Add a new discount and set the type to "Percentage" or "Subtract"

Code: Select all

| Customer Group | Quantity | Priority | Price   | Type         | Special | Date Start  | Date End   |
|----------------|----------|----------|---------|--------------|---------|-------------|------------|
| Default        | 1        | 0        | 20.0000 |  Percentage  |   true  | mm/dd/yyyy  | mm/dd/yyyy |
  • Click on save and view the products in homepage.
Similar issue also appear when type is "Subtract".

Temporary workaround: It seems to be working fine when type is "Fixed Amount".

Other Details
Opencart Version: 4.1.0.3
Theme: Default
Extensions Used: Default (Using Featured and Specials module)
Additional Extension: N/A
PHP: 8.2.12
Browser: Google Chrome - 136.0.7103.113 (Official Build) (64-bit)

Has anyone found another solution to resolve this issue? Which core files should I check or override via Events in order to resolve this issue? Please suggest.

Newbie

Posts

Joined
Sat Mar 01, 2025 4:22 pm
Location - India

Post by grgr » Thu May 29, 2025 7:26 am

Because that is not how it is working.
Specials and discounts are now on the same line which is a touch confusing I guess.

For a discount you add the amount and select Fixed/Subtract/percent, you can add many discounts (so you get buy 2 or more = x$, buy 10 or more = $y)
For specials, you only add the one line, the price and select the Special switch.

You can't have a product on discount and special at the same time.

-
Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by JNeuhoff » Thu May 29, 2025 5:16 pm

Could be related to this issue: https://github.com/opencart/opencart/issues/14755
Try the master branch (upcoming 4.1.0.4) to see whether this issue still exists or not.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by syd1037 » Sun Jun 01, 2025 12:18 pm

Anyone found any solution related to the Wrong discount price shows at front end? We are experiencing the same issue.

Newbie

Posts

Joined
Sun May 20, 2018 4:31 pm

Post by ninexus9 » Tue Jun 03, 2025 3:20 pm

JNeuhoff wrote:
Thu May 29, 2025 5:16 pm
Could be related to this issue: https://github.com/opencart/opencart/issues/14755
Try the master branch (upcoming 4.1.0.4) to see whether this issue still exists or not.
Hi, thanks for replying I tried the latest Github clone of master branch today and it seems the issue is not resolved in the latest commits.

I tried to set the discount like

Code: Select all

| Customer Group | Quantity | Priority | Price   | Type         | Special | Date Start  | Date End   |
|----------------|----------|----------|---------|--------------|---------|-------------|------------|
| Default        | 1        | 0        | 40.0000 |  Percentage  |   true  | mm/dd/yyyy  | mm/dd/yyyy |
Image

The price is still different in featured and specials section. Please take a look at screenshot given below for more details.
Image

Image

Also here's the screenshot of product page.
Image

The issue still exists. It shows correct price for products in featured section and also in the product page but shows incorrect price for product in special section (in homepage).

Newbie

Posts

Joined
Sat Mar 01, 2025 4:22 pm
Location - India

Post by ninexus9 » Tue Jun 03, 2025 4:29 pm

grgr wrote:
Thu May 29, 2025 7:26 am
Because that is not how it is working.
Specials and discounts are now on the same line which is a touch confusing I guess.
Hi grgr, thanks for replying.
grgr wrote:
Thu May 29, 2025 7:26 am
For a discount you add the amount and select Fixed/Subtract/percent, you can add many discounts (so you get buy 2 or more = x$, buy 10 or more = $y)
For specials, you only add the one line, the price and select the Special switch.
Yes, it works with Fixed Amount, the only issue occurs with Subtract & Percentage.
grgr wrote:
Thu May 29, 2025 7:26 am
You can't have a product on discount and special at the same time.
Are you sure? I haven't used Opencart version below 4.1.0.1 so the working of discounts might be the same as you mentioned for older versions but is it supposed to work like that in Opencart 4.x.x.x?

I think it would be awesome if we could use Percentage for specials too as while using "Fixed Amount " user has to calculate discount amount value before setting discount whereas Percentage makes it more easier.

Basically I want to display the following things on Product thumbnail, most things seems possible if I enable special.
  • Calculated discount price - can be displayed if special is disabled.
  • Old price or original price in strike-through - can only be displayed if special is enabled.
  • Percentage - Need to override the product/thumb view and calculate the percentage using twig tags and filters.
    It is possible for specials only as other cases does not provide any another amount value for calculation. Please check the code below for more details.

Code: Select all

{% if price %}
	 <div class="price d-flex gap-2">
		{% if not special %}
			<span class="price-new">{{ price }}</span>
		{% else %}
			{% set old_price = price|replace({(currency_symbol): '', ',': ''}) %}
			{% set new_price = special|replace({(currency_symbol): '', ',': ''}) %}
			{% set discount = ((old_price - new_price) / old_price) * 100 %}
			<div class="ribbon">
				<span>{{ discount|number_format(0) }}% OFF</span>
			</div>
			<span class="price-new">{{ special }}</span> <span class="price-old fw-light">{{ price }}</span>
		{% endif %}
		{% if tax %}
			<span class="price-tax">{{ text_tax }} {{ tax }}</span>
		{% endif %}
	</div>
{% endif %}
Is similar thing also possible for not special case? Please clarify.

Newbie

Posts

Joined
Sat Mar 01, 2025 4:22 pm
Location - India

Post by grgr » Mon Jun 09, 2025 7:40 am

The special works with percentage and subract.

What I am saying, is that you can't have specials and discounts at the same time. Well, you can, but they won't play well together and it seems a bit odd to discount a discount.

Product price 100
Special 50% = Product price 50
Discount 10 off = Product Price 75
Discount 1000 off = Product price 25

Which price are you going to use?

Are you realy wanting the discount price of 25 to be further discounted by 50% (special) so the product price then becomes 12.50?

-
Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 2 guests