0

Magento 2.1.

How can I limit the total cart/order weight so it does not exceed 7 KG?

I use "Table Rates" shipping method

0

Looking at the Cart model in magento 2.1 (/vendor/magento/module-checkout/Model/Cart.php)

We can see that the Save() method dispatches 2 events, checkout_cart_save_before and checkout_cart_save_after.

I would recommend that you create a plugin for checkout_cart_save_before where you would check the total weight of the quote, if it exceeds your maximum throw a magento ValidatorException with a message to the customer, otherwise proceed to save method.

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.