Skip to content
Snippets Groups Projects
Select Git revision
  • d14e15cc870310f1fcd461bbd2f7eb2eaa934cbf
  • main default protected
  • v1.302.0
  • v1.301.0
  • v1.300.0
  • v1.299.0
  • v1.298.0
  • v1.297.0
  • v1.296.0
  • v1.295.0
  • v1.294.0
  • v1.293.0
  • v1.292.0
  • v1.291.0
  • v1.290.0
  • v1.289.0
  • v1.288.0
  • v1.287.0
  • v1.286.0
  • v1.285.0
  • v1.284.0
  • v1.283.0
22 results

sqs.go

Blame
  • ShippingInformationManagement.php 1015 B
    <?php
    
    namespace bobgo\CustomShipping\Plugin;
    
    use Magento\Quote\Api\CartRepositoryInterface;
    
    use Magento\Checkout\Api\Data\ShippingInformationInterface;
    
    /**
     * Class ShippingInformationManagement
     * @package bobgo\CustomShipping\Plugin
     * This class is supposed to copy the suburb attribute from the quote to the order object.
     */
    class ShippingInformationManagement
    {
        public CartRepositoryInterface $cartRepository;
    
        public function __construct(
            CartRepositoryInterface $cartRepository,
        )
        {
            $this->cartRepository = $cartRepository;
        }
    
        public function beforeSaveAddressInformation($subject, $cartId, ShippingInformationInterface $addressInformation): array
        {
            $quote = $this->cartRepository->getActive($cartId);
            $deliveryNote = $addressInformation->getShippingAddress()->getExtensionAttributes()->getSuburb();
            $quote->setSuburb($deliveryNote);
            $this->cartRepository->save($quote);
            return [$cartId, $addressInformation];
        }
    
    }