1

My client want to set Maximum purchase order amount in magento2? and they need options like Minimum purchase order amount in admin.

can anyone please help..

  • Have you got any solution for this? – Suresh Chikani Sep 19 '17 at 11:19
  • No suresh. If you have any solution plz answer – Jenith Samuel Sep 20 '17 at 5:55
  • I am working on that once complete, I will post answer here. – Suresh Chikani Sep 20 '17 at 5:56
  • Have you already done this issue? – Konrad Siamro Dec 6 '17 at 9:33
  • no if you have answer please post – Jenith Samuel Dec 7 '17 at 6:34
1

Inchoo Wrote a nice article on Magento Maximum Allowed Order Amount Which States,

If you look at the Magento admin configuration area, you will see that Magento offers the opposite feature called Minimum Order Amount. You can find it under System > Configuration > Sales > Sales > Minimum Order Amount.

And this functionalty is not more diffrent from our Maximum Order Amount, The main difference is that with Maximum Allowed Order Amount you are not suppose to add anything new to the cart itself if it exceeds the maximum limit.

For our Functionality we are going to use event/observer with sales_quote_save_before

we only needed to add the following to our extension's config.xml file:

<config>
    <frontend>
        <events>
            <sales_quote_save_before> 
                <observers>
                    <inchoo_maxorderamount_enforceSingleOrderLimit>
                        <class>inchoo_maxorderamount/observer</class>
                        <method>enforceSingleOrderLimit</method>
                    </inchoo_maxorderamount_enforceSingleOrderLimit>
                </observers>
            </sales_quote_save_before>
        </events>
    </frontend>
</config>

And the following logic into our Observer.php model class file:

class Inchoo_MaxOrderAmount_Model_Observer
{
    private $_helper;

    public function __construct() 
    {
        $this->_helper = Mage::helper('inchoo_maxorderamount');
    }

    /**
     * No single order can be placed over the amount of X
     */
    public function enforceSingleOrderLimit($observer)
    {
        if (!$this->_helper->isModuleEnabled()) {
            return;
        }

        $quote = $observer->getEvent()->getQuote();

        if ((float)$quote->getGrandTotal() > (float)$this->_helper->getSingleOrderTopAmount()) {

            $formattedPrice = Mage::helper('core')->currency($this->_helper->getSingleOrderTopAmount(), true, false);

            Mage::getSingleton('checkout/session')->addError(
                $this->_helper->__($this->_helper->getSingleOrderTopAmountMsg(), $formattedPrice));

            Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
    }
}

This method allow us to use maximum order amount.

Or you can even download a inchoo extension For this Functionalty from this link

Hope this helps.

  • I think this for magento 1, i want in magento 2 – Jenith Samuel May 3 '17 at 12:05

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.