Skip to content

Commit

Permalink
Merge pull request #2186 from graphcommerce-org/update-magento-known-…
Browse files Browse the repository at this point in the history
…issues

Update magento known issues
  • Loading branch information
paales authored Feb 1, 2024
2 parents 0913d69 + 09eb25c commit 20a7c7e
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/good-rocks-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphcommerce/docs": patch
---

Update Magento known issues
68 changes: 67 additions & 1 deletion docs/magento/known-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ An overview of bugs and limitations you may run into with Magento's GraphQL API:

Affected Magento versions:

- `2.4.7`: only `2.4.7-beta1`
- `2.4.7`: fixed after 2.4.7-beta1
- `2.4.6`: all versions

This is caused by a regression which results in some GraphQL errors no longer
Expand All @@ -24,6 +24,72 @@ As a workaround, you can apply
See also
https://github.com/magento/magento2/commit/49cbe774020d3dfa6ee2b8702376a947801c9971

## After adding a product to cart with custom options, options are not saved and/or retrieving the cart results in an error

Affected Magento versions:

- `2.4.7`: unknown, see below
- `2.4.6`: all versions

When adding a product to cart, custom options are not processed and saved
correctly, and can result in an error on the `Cart.items.errors.message` field
when subsequently retrieving the cart, if the product had required custom
options.

The observed error happens because no value is given for the non-nullable
`message` field, however the original error occurs due a required custom option
not being present on the cart item, as the custom options we not saved correctly
during the previous `addProductsToCart` call.

Note that although the relevant PR for this fix was merged, the fix seems to
have gotten reverted and is not present in 2.4-develop at the time of writing,
and may not be included in the final release of 2.4.7.

As a workaround, you can apply
[fix-custom-option-processing.patch](./patches/fix-custom-option-processing.patch).

See also:

- Original PR: https://github.com/magento/magento2/issues/37599
- PR regarding revert of fix: https://github.com/magento/magento2/issues/37928

## Adding products to cart with pre-existing items that are out of stock always results in an error

Affected Magento versions:

- `2.4.7`: fixed after 2.4.7-beta2
- `2.4.6`: all versions

This is due to an inconsistency between errors that are reported through the
`AddProductsToCartOutput.user_errors` field and those on the cart items, which
make it impossible to differentiate between errors cause by the product that was
being added, and those from pre-existing cart items.

As a workaround you can apply
[fix-cart-user-error-reporting.patch](./patches/fix-cart-user-error-reporting.patch).

See also:

- Issue: https://github.com/magento/magento2/issues/37908
- PR with fix: https://github.com/magento/magento2/pull/38014/files

## Bundle selection products are not shown due to their visibility setting

Affected Magento versions:

- `2.4.6`: all versions

The `BundleItemOption.product` GraphQL field is returned as `null` if the
product visibility is set to not be visible in the catalog (which you may not
want).

As a workaround you can apply the following patches:

- [fix-bundle-selection-visibility-catalog.patch](./patches/fix-bundle-selection-visibility-catalog.patch)
- [fix-bundle-selection-visibility-related.patch](./patches/fix-bundle-selection-visibility-related.patch)

See also https://github.com/magento/magento2/issues/37774

## Next steps

- [Overview](./readme)
17 changes: 17 additions & 0 deletions docs/magento/patches/fix-bundle-selection-visibility-catalog.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Fix bundle product children not showing up on some products, see https://github.com/magento/magento2/issues/37774

@package magento/module-catalog-graph-ql

diff --git a/Model/Resolver/Products/DataProvider/Product.php b/Model/Resolver/Products/DataProvider/Product.php
index 30be41072242b..3e955ae303453 100644
--- a/Model/Resolver/Products/DataProvider/Product.php
+++ b/Model/Resolver/Products/DataProvider/Product.php
@@ -89,7 +89,7 @@ public function getList(

$this->collectionPreProcessor->process($collection, $searchCriteria, $attributes, $context);

- if ($isChildSearch) {
+ if (!$isChildSearch) {
$visibilityIds = $isSearch
? $this->visibility->getVisibleInSearchIds()
: $this->visibility->getVisibleInCatalogIds();
19 changes: 19 additions & 0 deletions docs/magento/patches/fix-bundle-selection-visibility-related.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Fix bundle product children not showing up on some products, see https://github.com/magento/magento2/issues/37774

@package magento/module-related-product-graph-ql

diff --git a/Model/Resolver/Batch/AbstractLikedProducts.php b/Model/Resolver/Batch/AbstractLikedProducts.php
index fac7b23d408e3..f35af6f4885d2 100644
--- a/Model/Resolver/Batch/AbstractLikedProducts.php
+++ b/Model/Resolver/Batch/AbstractLikedProducts.php
@@ -94,9 +94,7 @@ private function findRelations(array $products, array $loadAttributes, int $link
$this->searchCriteriaBuilder->addFilter('entity_id', $relatedIds, 'in');
$relatedSearchResult = $this->productDataProvider->getList(
$this->searchCriteriaBuilder->create(),
- $loadAttributes,
- false,
- true
+ $loadAttributes
);
//Filling related products map.
/** @var \Magento\Catalog\Api\Data\ProductInterface[] $relatedProducts */
21 changes: 21 additions & 0 deletions docs/magento/patches/fix-cart-user-error-reporting.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Fix add to cart `user_error` field containing inconsistent errors. See https://github.com/magento/magento2/pull/38014

@package magento/module-quote

--- a/Model/Cart/AddProductsToCart.php
+++ b/Model/Cart/AddProductsToCart.php (date 1696845624268)
@@ -80,14 +80,6 @@
$cartId = $this->maskedQuoteIdToQuoteId->execute($maskedCartId);
$cart = $this->cartRepository->get($cartId);
$allErrors = [];
- if ($cart->getData('has_error')) {
- $errors = $cart->getErrors();
-
- /** @var MessageInterface $error */
- foreach ($errors as $error) {
- $allErrors[] = $this->error->create($error->getText());
- }
- }

$failedCartItems = $this->addItemsToCart($cart, $cartItems);
$saveCart = empty($failedCartItems);
15 changes: 15 additions & 0 deletions docs/magento/patches/fix-custom-option-processing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Fix custom options not saving on addProductsToCart. See https://github.com/magento/magento2/issues/37599

@package magento/module-quote

--- a/Model/Quote.php
+++ b/Model/Quote.php
@@ -1647,6 +1647,8 @@ public function addProduct(
);
}

+ $productId = $product->getId();
+ $product = clone $this->productRepository->getById($productId, false, $this->getStore()->getId());
$cartCandidates = $product->getTypeInstance()->prepareForCartAdvanced($request, $product, $processMode);

/**

0 comments on commit 20a7c7e

Please sign in to comment.