0

How can the price of a particular Category be excluded from the minimum order amount in Magento 2.3 I'm wondering how to approach this problem?

1 Answer 1

0

The base method to calculate the minimum amount is found here vendor/magento/module-quote/Model/Quote.php in the function validateMinimumAmount().

Then most likely if you use standard shipping the minimum order amount verification is made here vendor/magento/module-quote/Model/Quote/Address.php in the function validateMinimumAmount().

return $includeDiscount ?
        ($this->getBaseSubtotalWithDiscount() + $taxes >= $amount) :
        ($this->getBaseSubtotal() + $taxes >= $amount);

Now you have multiple possibility to create your custom calculation in an after plugin on this method.

1 : You can add a new field to the quote that contains the the base subtotal in which you exclude products from that category. This would be the best way to do it but it is a little bit complicated.

2 : The second way to do this would be to make your own calculation in the after plugin by loading all quote items and sum up the price of the available items and see in the end if your new subtotal is >= than the minimum amount for shipping.

2
  • Thanks for your reply, can you please explain the second one . I'm new to magento 2 Commented Sep 13, 2021 at 17:38
  • Explaining everything would be long but you can start here to see how you can create and use an after plugin : devdocs.magento.com/guides/v2.4/extension-dev-guide/…. Basically the plugin will allow you to change the output of the original function . Commented Sep 13, 2021 at 18:34

Your Answer

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

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