...
Code Block |
---|
class CustomerType extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource { public function getAllOptions() { if ($this->_options === null) { $this->_options = [ ['value' => self::PRIVATE, 'label' => __('Private')], ['value' => self::BUSINESS, 'label' => __('Business')] ]; } return $this->_options; } } |
Saving address form
vendor/creativestyle/magesuite-business-checkout/Plugin/Checkout/Model/ShippingInformationManagement/SaveCustomerTypeInQuote.php:16
Code Block |
---|
class SaveCustomerTypeInQuote { public function beforeSaveAddressInformation( \Magento\Checkout\Model\ShippingInformationManagement $subject, $cartId, \Magento\Checkout\Api\Data\ShippingInformationInterface $addressInformation ) { $shippingAddress = $addressInformation->getShippingAddress(); ..... $customerType = $shippingAddress->getExtensionAttributes()->getCustomerType(); ..... $quote = $this->quoteRepository->getActive($cartId); $quote->setCustomerType($customerType); return [$cartId, $addressInformation]; } } |
...