2

Is possible to exclude some SKUs from minimum order amount?

For example: Our limit for minimum order is 30$ and we don't want to include items #1, #2 and #3 into this limit because they are only bonus for customers..

Thank you in advance.

1
  • Does anyone know please?
    – sidlo
    Feb 13, 2015 at 13:33

2 Answers 2

1

You can rewrite the validateMinimumAmount in the class app\code\core\Mage\Sales\Model\Quote\Address.php

Currently it works like

    $amount = Mage::getStoreConfig('sales/minimum_order/amount', $storeId);
    if ($this->getBaseSubtotalWithDiscount() < $amount) {
        return false;
    } 

but you can increase the amount for each specific item like

    $amount = Mage::getStoreConfig('sales/minimum_order/amount', $storeId);
    foreach($this->getAllItems() as $item){
        if(in_array($item->getSku(), array("spacial item #1", "spacial item #2")))
        $amount += $item->getPrice(); 
    }

so the next condition will "skip" them

    if ($this->getBaseSubtotalWithDiscount() < $amount) {
        return false;
    } 
5
  • Thank you for your help. Can you please give the whole code how it should look like? I'm unable to make this working. Cheers
    – sidlo
    Feb 13, 2015 at 21:52
  • do you have any errors? You can copy the Address.php (with folders) into the /local/ code base and make direct chnages without creating a new module and rewriting the model.
    – Amasty
    Feb 13, 2015 at 21:56
  • I'm actually editing the magento core at testing website. But the problem is I don't quite understand that function. This is what I did $amount = Mage::getStoreConfig('sales/minimum_order/amount', $storeId); foreach($this->getAllItems() as $item){ if(in_array($item->getSku(), array("spacial item #1", "spacial item #2"))) $amount += $item->getPrice(); } if ($this->getBaseSubtotalWithDiscount() < $amount) { return false; } return true; } But it doesn't work. No errors.
    – sidlo
    Feb 13, 2015 at 21:59
  • did you set your SKUs?
    – Amasty
    Feb 13, 2015 at 22:26
  • Sure, I did. But I guess I have combined those 2 function incorrectly.
    – sidlo
    Feb 13, 2015 at 22:28
0

I have just found module which contain fuction I need. It charges fee if order amount is less than minimum and I can exclude my bonus products.

https://github.com/unleashedtech/min-order-fee-magento

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.