-
Notifications
You must be signed in to change notification settings - Fork 154
Provide available shipping rates for addresses #339
Provide available shipping rates for addresses #339
Conversation
c62f3d2
to
4b84afb
Compare
@@ -50,6 +61,12 @@ public function getCartAddresses(CartInterface $cart): array | |||
if ($shippingAddress) { | |||
$shippingData = $this->dataObjectConverter->toFlatArray($shippingAddress, [], AddressInterface::class); | |||
$shippingData['address_type'] = 'SHIPPING'; | |||
if ($includeShippingMethods) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using second parameter-flag we can move this logic to separate class
return $this->addressDataProvider->getCartAddresses($cart, $this->includeShippingMethods($info)); | ||
} | ||
|
||
private function includeShippingMethods(ResolveInfo $info): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we declare separate resolver for available_shipping_methods
in a scheme we don't need this class
@@ -112,7 +112,7 @@ type CartAddress { | |||
telephone: String | |||
address_type: AdressTypeEnum | |||
selected_shipping_method: CheckoutShippingMethod | |||
available_shipping_methods: [CheckoutShippingMethod] | |||
available_shipping_methods: [CheckoutAvailableShippingMethod] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can split logic between different resolvers
Like addresses: [CartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddresses")
It will simplify our code and relations
2f7237a
to
6d6d5d5
Compare
…s for current cart
Hi @pmclain, thank you for your contribution! |
Documented as part of magento/devdocs#4502 |
Description (*)
Provide ability to retrieve available shipping rates for all cart shipping addresses. This PR separates the types of selected rate and available rates. Available methods are quite different objects from selected methods, given the selected methods are really just attributes of quote addresses.
This continues building some prerequisites for #39 #285
Manual testing scenarios (*)
available_shipping_methods
Contribution checklist (*)