SendCloud / sendcloud

A Magento 2 module for Sendcloud
9 stars 21 forks source link

Magento2.4.4 TypeError: Argument 1 passed to Plugin\Cart\CheckoutCartRepository::afterGet() #136

Closed Hayyan-Ebrahem closed 2 years ago

Hayyan-Ebrahem commented 2 years ago

Magento 2.4.4 Composer 2.3.5 Sendcloud 2.0.3

In checkout payment when proceeding to last step:

TypeError: Argument 1 passed to SendCloud\SendCloud\Plugin\Cart\CheckoutCartRepository::afterGet() must be an instance of Magento\Quote\Model\QuoteRepository, instance of Magento\AsyncOrder\Model\CartRepository\Interceptor given, called in /vendor/magento/framework/Interception/Interceptor.php on line 146 and defined in vendor/sendcloud/sendcloud/Plugin/Cart/CheckoutCartRepository.php:49

This will fix this error

/**
 * @param CartRepositoryInterface $subject
 * @param CartInterface $cart
 * @return CartInterface
 */
public function afterGet(CartRepositoryInterface $subject, CartInterface $cart)
{
    $this->loadSendCloudExtensionAttributes($cart);

    return $cart;
}

/**
 * @param CartRepositoryInterface $subject
 * @param CartSearchResultsInterface $cartCollection
 * @return CartSearchResultsInterface
 */
public function afterGetList(CartRepositoryInterface $subject, CartSearchResultsInterface $cartCollection)
{
    foreach ($cartCollection->getItems() as $cart) {
        $this->loadSendCloudExtensionAttributes($cart);
    }

    return $cartCollection;
}
ivabocheva commented 2 years ago

Hi Hayyan-Ebrahem,

Thank you for your feedback, we are currently reviewing it.

Kind regards,

The Sendcloud team

teodoratimoti commented 2 years ago

Hi Hayyan-Ebrahem,

Please note that our team found what the issue is and we fixed it.

The new version 2.0.4 is released on both marketplace and GitHub.

Thank you,

Best regards.