Skip to content

Instantly share code, notes, and snippets.

@mklooss
Created January 2, 2013 15:14
Show Gist options
  • Select an option

  • Save mklooss/4435272 to your computer and use it in GitHub Desktop.

Select an option

Save mklooss/4435272 to your computer and use it in GitHub Desktop.
Magento do not merge Customer Quote, if current quote is not empty
<?php
class Observer {
public function load_customer_quote_before($observer)
{
$checkout_session = $observer->getEvent()->getCheckoutSession();
if($checkout_session->getQuote()->getItemsCount() < 1) // check if current quote has items
{
return $this;
}
$customerQuote = Mage::getModel('sales/quote')
->setStoreId(Mage::app()->getStore()->getId())
->loadByCustomer(Mage::getSingleton('customer/session')->getCustomerId());
$customerQuote->delete();
return $this;
}
}
@mklooss
Copy link
Author

mklooss commented Jan 2, 2013

Event in File: app/code/core/Mage/Checkout/Model/Session.php
in Method: loadCustomerQuote

Mage::dispatchEvent('load_customer_quote_before', array('checkout_session' => $this));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment