fix: SFCC-476: Local size and color variation attribute values not retrieved correctly by aggregatedValueHandlers #247
+5
−2
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.
Reopened this pull request to target develop; the branch from the declined pull request contained a lot of extra code that was not needed here.
Added explanatory comment for the workaround.
Original description
Update: this may not be a code issue on the cartridge's side -- the proper values should be returned for local variation attributes with the code we’re using. Until this is fixed by SFCC, we can add our workaround, it won't hurt anything even when if it's eventually fixed (in that case the code proceeds on the ternary if's
truebranch, so the workaround code is never reached). The workaround extracts the same information as the original code would if it worked as intended.Locally-defined size and color variation attribute values are currently not exported at all.
Variation attributes, like size or color, can be local, where the values are created for a specific product and cannot be used with other products (save from redefining them there) or shared (also called global or per-catalog variation attributes), where the variation attribute’s possible values are defined for the whole catalog, with any product being able to use these pre-defined values (example: common shoe sizes, common clothing sizes like S, M, L, etc.).
With the way the color and size attributes are currently retrieved in the code, these attributes are only returned if the master has a shared variation attribute.
The code works as intended for shared variation attributes, but in the case of a locally-defined variation attribute,
colorAttributeandsizeAttributeboth becomenulleven if there is a value defined for size or color, so the ternaryif’sfalsebranch is executed, returningnull.Modified the code so that
product.custom.size(local variation attribute) is returned if retrieving the shared attribute fails.Please see SFCC-476 for more details.