I want to skip some products whenever reorder. file path in vendor folder (vendor/magento/module-sales/Controller/AbstractController/Reorder.php:57) and it is an abstract Class.

I want simply add this code condition. if($item->getSku() != 'offer123') Is it possible by plugin ?

foreach ($items as $item) {
   if($item->getSku() != 'offer123'){ // i want to apply this condition 
            try {
            } catch (\Magento\Framework\Exception\LocalizedException $e) {
                if ($this->_objectManager->get(\Magento\Checkout\Model\Session::class)->getUseNotice(true)) {
                } else {
                return $resultRedirect->setPath('*/*/history');
            } catch (\Exception $e) {
                $this->messageManager->addException($e, __('We can\'t add this item to your shopping cart right now.'));
                return $resultRedirect->setPath('checkout/cart');

Thanks in advance.

1 Answer 1


Try following code. It is working for me.

File: etc/di.xml

<type name="Magento\Checkout\Model\Cart">
    <plugin name="custom_skip_product_addtocart" type="[Vendor]\[Module]\Plugin\Cart" sortOrder="100"/>

Then create following file in your module.

File: Plugin/Cart.php


namespace [Vendor]\[Module]\Plugin;

class Cart
    public function aroundAddOrderItem($subject, callable $proceed, $orderItem, $qtyFlag = null)
        if ($orderItem->getParentItem() === null) {
            $sku = $orderItem->getSku();
            if(in_array($sku, ['WT08-XS-Black']))
                return $this;
                return $proceed($orderItem, $qtyFlag);
        return $this;

Let me know if you have any trouble.

  • Hi Yash7690 It's working perfect :-) , Thanks a lot. Commented Feb 13, 2019 at 11:40
  • Thats great !!! Cheers !!!
    – Yash Shah
    Commented Feb 13, 2019 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.