We are trying to extend the Catalog Price Rules to make it possible to increase the price of a small group of products.

We have already tried to adjust the calculation in the file below, but this has no effect at all.


All help is greatly appreciated!


1 Answer 1


I'm suggesting you to create a plugin

<type name="\Magento\Checkout\Controller\Index\Index">
    <plugin name="before-checkout-index" type="\Cpy\Checkout\Plugin\Controller\Checkout\Index" sortOrder="1" disabled="false"/>

Then in that plugin you can call you helper

Something like that

 * @param $subject
 * @param $proceed
 * @return mixed
public function aroundExecute($subject, $proceed)
    $errors =  $this->addToCartHelper->checkCart();

    if(is_array($errors)) {
        foreach($errors as $error) {
        return $this->redirectFactory->create()->setPath('checkout/cart');
    } else {
        return $proceed();

Where addToCartHelper is your custom helper and checkCart() the method that will return you all the errors messages depending on your logic

On the helper, you can reach all the items like below

public function checkCart()
    $errors = [];
    $items = $this->_checkoutSession->getQuote()->getAllVisibleItems();
    // ...

    if(!count($errors)) {
        return true;
    } else {
        return $errors;
  • Thank you for your answer! Only I am looking for a solution within the Catalog Price Rule
    – Timo
    Nov 15, 2021 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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