When I added __construct whatever I get an infinite loader.
public function __construct(ResultFactory $res){ $this->anotherVariable = $res; } my
<?php namespace Vendor\Module\Plugin; use Magento\Framework\App\Config\ScopeConfigInterface; class MyShippingPlugin { private $anotherVariable; public function __construct(ScopeConfigInterface $res){ $this->anotherVariable = $res; } public function aroundCollectRates( \Magento\Shipping\Model\Shipping $subject, \Closure $proceed, \Magento\Quote\Model\Quote\Address\RateRequest $request ) { return $proceed($request); } } my 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\Shipping\Model\Shipping"> <plugin name="vendor_module_shipping_plugin" type="\Vendor\Module\Plugin\MyShippingPlugin" sortOrder="10" </type> </config> If I remove the constructor everything works, if not then an infinite loader