-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core][Shipping] Fix shipping method choice type #5216
[Core][Shipping] Fix shipping method choice type #5216
Conversation
$methods = $resolver->getSupportedMethods($options['subject']); | ||
break; | ||
} | ||
} |
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.
Let's move this logic to the "main" methods resolver and inject it here. It will support every shipment and use exactly this logic to get the right methods. (CompositeMethodsResolver as name, wdyt?)
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.
Sure 👍 Less logic in form type is always a good choice 😄
445de00
to
7135621
Compare
7135621
to
64c3676
Compare
if ($this->sharedStorage->has('channel')) { | ||
$channel = $this->sharedStorage->get('channel'); | ||
$channel->addShippingMethod($shippingMethod); | ||
} |
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.
This if
should be before $this->shippingMethodRepository->add($shippingMethod);
. Right now the relation is not flushed in this step.
63c3f07
to
d0ee908
Compare
Nice work Mateusz, thanks! Note: in separate PR, we could remove the CompositeMethodsResolverInterface - This could be an implementation of ShippingMethodsResolverInterface - no need for new contract. Anyway, this is a minor improvement. 👍 |
…methods-also-by-channel [Core][Shipping] Fix shipping method choice type
There was a problem with
ShippingMethodChoiceType
, as it didn't use channel to list shipping methods and also not available for channel methods have been... available.Instead of quick fix, I've rebuild deeply shipping methods resolver logic:
ShippingMethodChoiceType
uses prioritized registry to get proper shipping methods resolverThis changes allowed to remove
ShippingMethodChoiceType
instance from Core. Also it's now highly simple to use own shipping methods resolver (it has to be just implemented and tagged with proper priority).