Jump to content

Discounts and Vouchers rules PS 1.7.6.9


Recommended Posts

I'm facing some problems managing the cart rules of PrestaShop. I added an image with my settings.

I mean it's straight forward, i just excluded some rules that should not work with my voucher code and just tick the box that says “Exclude discounted products” or something similar.

Now here is the problem, when i add a product that has a discount, i get a prompt that “It's not compatible etc....” but if i add another product with no additional discount, the voucher can be applied and the discount/price reduction is given for the total cart amount and not just the product with no discount.'

In my example:

4.16(has discount)+18.20(no discount)=22.36 total. The 30% discount that is applied via the voucher is 6.71 which is from the total car amount.

The 30% should be only for the product that does not have discount, meaning only for 18.20 and this should equate to 5.46 discount.

Does anyone have any solutions or am i missing something.

Untitled-1.jpg

Link to comment
Share on other sites

Hello mk2-pronat,

This is a known issue in PS 1.7.6.9. You’ve done everything right by ticking Exclude discounted products, but due to a core bug the percentage discount is still calculated on the entire cart once you mix discounted and non-discounted items github.com. According to the official docs, Exclude discounted products should keep the voucher from touching any product already on sale , but in 1.7.6.9 it doesn’t behave correctly in mixed carts.

You have three main options:

Upgrade PrestaShop
This bug has been resolved in later releases (1.7.8.x and PS 8.x). If you can, upgrade your shop—your voucher will then correctly apply 30% only to non-discounted products.

Apply a small override
Create a module (e.g. modules/cartfix) that overrides the core filter to properly strip out products with specific prices. For example, put this in modules/cartfix/override/adapter/Cart/CartRuleProductFilter.php:

<?php
class CartRuleProductFilter extends CartRuleProductFilterCore
{
    protected function filterProductsWithExistingDiscount(array $products): array
    {
        if ($this->cartRule->reduction_exclude_special) {
            foreach ($products as $key => $product) {
                // Retrieve the standard (undiscounted) price
                $standardPrice = Product::getPriceStatic(
                    $product['id_product'],
                    false,
                    $product['id_product_attribute'],
                    6,
                    null,
                    false,
                    true,
                    1,
                    false,
                    null,
                    null,
                    $this->context->shop->id
                );
                // If the cart price is lower, it’s on sale → remove it
                if ($product['price'] < $standardPrice) {
                    unset($products[$key]);
                }
            }
        }
        return $products;
    }
}
 

– Once installed, clear your cache (BO > Advanced Parameters > Performance) and test again.

Category-based workaround
If you don’t want to touch code, create a “Full-Price” category and assign only those non-discounted products to it. Then in your cart rule’s Conditions tab add a Product selection rule for that category. Your 30% voucher will only ever see—and discount—products in “Full-Price.”

Any of these will ensure your 30% applies strictly to non-discounted items (18.20 € → 5.46 € off) rather than the full 22.36 € total. Good luck!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...