In my extension's config.xml I'm observing the sales_quote_remove_item event. I'd like to get the SKU of the item that was removed from the cart.

I've the steps mentioned in https://stackoverflow.com/questions/4255083/magento-how-to-check-if-a-product-has-already-been-removed-from-the-cart to no avail. var_dump() on the $observer object spits out too much info to be intelligible.

I have a custom extension that adds bonus products depending on certain groups. I'd like for it to continue listening on sales_quote_remove_item but to ignore any of the bonus SKUs themselves.

  • Can you post your code? It is a little hard answering when you can't see what you have already have done. – kab8609 Dec 5 '14 at 21:35
  • the $product variable, have you tried var_dump($product->getData()) – Rabea Dec 6 '14 at 1:05

I figured it out. I had to use getEvent(). The following worked:

public function manageCart($observer) {

  $product = $observer->getEvent()->getProduct();

  // do nothing if we're adding or removing BONUS
  if ($product) {
          if (strpos($product->getSku(), "BONUS") !== false) {
            $this->log("getProduct() skipping BONUS");
            return; // exit observer
  } else {
        /* other logic here */

| 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.