I want to show the product's special price in the catalog but I am getting an error when there is more than one product with a discount. One color product's click triggers a change in all catalog.

I changed the condition on the file:


It in order to show the special price on catalog product, like this:

<?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?>


<?php if ($block->hasSpecialPrice()): ?>

On page load, this is the current view:

Page load

If I click in a color with a discount (the white color on the first product), it triggers changes on the second one, like this:

The second product changes when I click the first one too

I am struggled to find where I need to change to fix this problem. Any idea will be more than welcome.


I finally found a solution to my problem. I changed the _UpdatePrice() function from:

if (typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount) {
} else {


if (typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount) {
} else {

The previous code was looking for the .sly-old-price selector, finding more than one match causing the change in all products. Narrowing the search to the product's container solves the problem.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.