Wednesday 18 October 2017

Magento 2 : issues with M2E Pro 'Duplicated line on invoice/order for configurable product'[solved]

Duplicated line on invoice/order for configurable product

When configurable product is ordered, Magento show 2 lines in order (and in invoice)
configurable product generates 2 lines : one with the actual price and the other one with $0 price.

Go this location:
app/code/Ess/M2ePro/Plugin/Order/Magento/Quote/Model/Quote/Item/

Replace 2 function :

public function aroundConvert($interceptor, \Closure $callback, $item)
    {
        return $this->execute('convert', $interceptor, $callback, [$item]);
    }

    // ---------------------------------------

    protected function processConvert($interceptor, \Closure $callback, $arguments)
    {
        $orderItem = $callback($arguments[0]);

        $this->eventManager->dispatch(
            'ess_sales_convert_quote_item_to_order_item',
            [
                'order_item' => $orderItem,
                'item' => $arguments[0],
            ]
        );

        return $orderItem;
    }
 

    To:
 
 
   public function aroundConvert($interceptor, \Closure $callback, ...$arguments)
    {
        return $this->execute('convert', $interceptor, $callback, $arguments);
    }

    // ---------------------------------------

    protected function processConvert($interceptor, \Closure $callback, $arguments)
    {
        $orderItem = $callback(...$arguments);

        $this->eventManager->dispatch(
            'ess_sales_convert_quote_item_to_order_item',
            [
                'order_item' => $orderItem,
                'item' => $arguments[0],
            ]
        );

        return $orderItem;
    }
    

No comments:

Post a Comment