classic506 Posted May 19, 2016 Share Posted May 19, 2016 Hi!, does anyone know how to exclude a category from coupon on the latest Prestashop version 1.6.1.0? For example: We created a coupon of 50% to be a apply to a certain category, however. If a customer comes in and adds a product from a different category to the existing cart... the coupon will apply to the products of both categories. Is there a way to have the coupon applying the 50% to the category it was created for and none other? Thanks for your time! Ali. Link to comment Share on other sites More sharing options...
NemoPS Posted May 21, 2016 Share Posted May 21, 2016 I think you need some custom coding here.The CartRule class has a checkValidity() method. Within it, I'd say at the end, you might try to loops through all products (if $products is not assigned, use $context->cart->getProducts().Then get all categories for each. if any of them is not in the category you want (you will have to hardcode the ID), then return an error return (!$display_error) ? false : Tools::displayError('Invalid Category');Like that Link to comment Share on other sites More sharing options...
Disual Posted May 19, 2022 Share Posted May 19, 2022 hello, how to load product categories in CartRule class checkValidity method? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now