DefaultShippingAddressChooser.php 608 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\InstantPurchase\Model\ShippingAddressChoose;
  7. use Magento\Customer\Model\Customer;
  8. use Magento\Customer\Model\Address;
  9. /**
  10. * Shipping address chooser implementation to choose customer default shipping address.
  11. */
  12. class DefaultShippingAddressChooser implements ShippingAddressChooserInterface
  13. {
  14. /**
  15. * @inheritdoc
  16. */
  17. public function choose(Customer $customer)
  18. {
  19. $address = $customer->getDefaultShippingAddress();
  20. return $address ?: null;
  21. }
  22. }