1

I configured a minimum order value of 15€ in the magento backend, but it seems that this value is not involve the tax, so if I add a product to the cart which costs 17€ I get the message that the minimum order value is not reached :(.

How can I fix this, so that the minimum order value containing the tax?

2

Did some quick debugging grepping for the sys/conf path ending up in the CartController that refers to the Quote model method validateMinimumAmount.

I'm guessing you're not using multishipping so this part of the code calculates whether the amount is enough to be ordered.

$baseTotal = 0;
foreach ($addresses as $address) {
    /* @var $address Mage_Sales_Model_Quote_Address */
    $baseTotal += $address->getBaseSubtotalWithDiscount();
}
if ($baseTotal < $minAmount) {
    return false;
}

It uses the subtotal to verify the minimum order amount theoretically if you set the sub total of a quote to exclude include tax it should fix the issue. Didn't test it so you might need to tweak a bit with the settings.

If all else fails you can always overwrite that part of code to fit your needs. Inchoo has a nice article on overwriting models

Edit: To further clarify:

  • The base totals are the totals given in the shop's currency. The final totals (without base prepended) are converted to the customer's currency.
  • The WithDiscount() part includes catalog rule promotions and discounts configured on the product level. It specifically does not include checkout discounts (often referred to as cart discounts, which is an unfortunate choice of words if you ever tried to reflect those discounts in a mini-cart).
| improve this answer | |
  • 1
    If I add an article to my cart, the cart looks as follows: Subtotal: 17,50 € incl. Tax: 2,79 € Total: 17,50 € But the minimum order amount message still says the that the minimum order amount is not reached. – Fox Jan 28 '15 at 14:28
  • So I have to overwrite this part? – Fox Jan 28 '15 at 14:34
  • Yes, thats correct – Sander Mangel Jan 28 '15 at 20:18
1

Rewrite the model Mage_Sales_Model_Quote_Address and override the method validateMinimumAmount:

<?php

class StackExchange_MinimumOrderValue_Model_Quote_Address extends Mage_Sales_Model_Quote_Address
{

    /**
     * Validate minimum amount
     *
     * @return bool
     */
    public function validateMinimumAmount()
    {
        $storeId = $this->getQuote()->getStoreId();
        if (!Mage::getStoreConfigFlag('sales/minimum_order/active', $storeId)) {
            return true;
        }

        if ($this->getQuote()->getIsVirtual() && $this->getAddressType() == self::TYPE_SHIPPING) {
            return true;
        } elseif (!$this->getQuote()->getIsVirtual() && $this->getAddressType() != self::TYPE_SHIPPING) {
            return true;
        }

        $amount = Mage::getStoreConfig('sales/minimum_order/amount', $storeId);
        // $this->getBaseSubtotalInclTax() is sometimes null, so that we calculate it ourselves
        $referenceAmount = $this->getBaseSubtotal() + $this->getBaseTaxAmount() + $this->getBaseHiddenTaxAmount() - $this->getBaseShippingTaxAmount() - abs($this->getBaseDiscountAmount());
        if ($referenceAmount < $amount) {
            return false;
        }
        return true;
    }

}

The interesting thing is that $this->getBaseSubtotalInclTax() does not work. It is sometimes null - specifically, if you proceed from the cart to the checkout page. Hence, we calculate the subtotal inclusive tax ourselves. I hope my formula is correct, but it seems to work:

$referenceAmount = $this->getBaseSubtotal() + $this->getBaseTaxAmount() + $this->getBaseHiddenTaxAmount() - $this->getBaseShippingTaxAmount() - abs($this->getBaseDiscountAmount());
| improve this answer | |
0

No need to rewrite modules. Just type down the value excluding sales tax in the back-end. After that enter a custom message in the display message field. For example if you have 21% sales tax:

  • write a minimum order value of €12.40 in the back-end.
  • write the following message in the display message field: minimum order amount is €15.00
| improve this answer | |

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.