fix(wishlist-graphql): resolve configured_variant for parent_sku+sku input (#40588)#40834
Open
lbajsarowicz wants to merge 2 commits into
Open
fix(wishlist-graphql): resolve configured_variant for parent_sku+sku input (#40588)#40834lbajsarowicz wants to merge 2 commits into
lbajsarowicz wants to merge 2 commits into
Conversation
…rable child by SKU addProductsToWishlist accepts both `selected_options` (encoded option IDs) and `parent_sku` + `sku` to identify a configurable child. Only the selected_options input ran through SuperAttributeDataProvider, so when a caller supplied parent_sku + child sku the buy request never carried `super_attribute`, the wishlist item never recorded a `simple_product` option, and `configured_variant` resolved to null. Add ChildSkuDataProvider: when parent_sku is set, sku differs, and no selected_options were sent, load both products, walk the parent's configurable attributes, and emit `super_attribute` => attribute_id mapped to the child's stored value. Wired into the existing BuyRequestBuilder provider list in etc/graphql/di.xml. Fixes magento#40588
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
…HPCS violations Add PHPUnit test class covering all execution paths of ChildSkuDataProvider: happy path super_attribute map build, early returns for selected_options present, parent_sku equals sku, no parent_sku, NoSuchEntityException, and non-configurable parent type. Use Magento\Catalog\Model\Product mocks so getData() is mockable without resorting to interface mocks with addMethods().
Contributor
Author
|
@magento run all tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
addProductsToWishlistaccepts bothselected_options(encoded option IDs) andparent_sku+skuto identify a configurable child. Only theselected_optionsinput ran throughSuperAttributeDataProvider, so when acaller supplied
parent_sku+ childskuthe buy request never carriedsuper_attribute, the wishlist item never recorded asimple_productoption,and
configured_variantresolved to null.Added
ChildSkuDataProvider: whenparent_skuis set,skudiffers, and noselected_optionswere sent, load both products, walk the parent'sconfigurable attributes, and emit
super_attributemapping eachattribute_id to the child's stored value. Wired into the existing
BuyRequestBuilderprovider list inetc/graphql/di.xml.Fixes #40588
Fixed Issues
Manual testing scenarios
Before:
configured_variantisnull. After:configured_variant.sku == "configurable-red".Contribution checklist