I try to add a new product in a afterSave plugin for Magento\Quote\Api\CartItemRepositoryInterface, but I get:
Type Error occurred when creating object: Company\Quote\Plugin\RalSpecialColorPriceSurcharge, Argument 3 passed to Company\Quote\Plugin\RalSpecialColorPriceSurcharge::__construct() must be an instance of Magento\Catalog\Model\ProductFactory, instance of Magento\Framework\App\Config given, called
app\code\Company\Quote\etc\di.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Quote\Api\CartItemRepositoryInterface"> <plugin name="company_quote_ral_specialcolor_price_surcharge" type="Company\Quote\Plugin\RalSpecialColorPriceSurcharge" sortOrder="10"/> </type> </config> app\code\Company\Quote\Plugin\RalSpecialColorPriceSurcharge.php
<?php namespace Company\Quote\Plugin; use \Magento\Catalog\Model\ProductFactory; class RalSpecialColorPriceSurcharge { /** * @var Company\Quote\Model\Config\Settings */ private $settings; public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, ) { $this->productFactory = $productFactory; } ...