Fix checking active carrier against store #7344
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Scope specifically enabled carrier does not work
Bug Reproduction
Prerequisite
There are two websites.
Flatrate
is disabled indefault
scope and the first website, and enabled in the second website.NOTE: We need two websites in this test case to make sure the MAGE_RUN_CODE will only be set against the first website when visiting Admin Panel
Steps
Get shipping methods and rates
Expected Result
Flatrate
shows up as avaliable shipping methodActual Result
Flatrate
does not show upCause of issue
\Magento\Shipping\Model\CarrierFactory::createIfActive
only check if a carrier is active against a scope resolved by scope-resolver which takes the MAGE_RUN_CODE to resolve. If a carrier is disabled by default and by the the website of MAGE_RUN_CODE and only enabled for specific websites, the method will returnfalse
which is wrong