Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: catch NoSuchEntityException in InvalidSkuProcessor for bundle pr…
…oducts

productRepository->get($sku) in retrieveInvalidSkuList() had no exception
handling for the case where a bundle product is deleted between the initial
retrieveProductIdsBySkus() lookup and the repository fetch. This caused an
uncaught NoSuchEntityException to propagate up and fail the entire batch
when using POST /V1/products/base-prices with bundle products.

Apply the same try/catch pattern used in ACP2E-4998 (TierPriceValidator):
catch NoSuchEntityException and treat the SKU as invalid so the rest of
the batch continues processing.

Fixes #40882
  • Loading branch information
kapilvus committed Jun 15, 2026
commit 321baf009cdd6958e031dd79b0253af5b4fd3bbc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

namespace Magento\Catalog\Model\Product\Price\Validation;

use Magento\Framework\Exception\NoSuchEntityException;

/**
* Class is responsible to detect list of invalid SKU values from list of provided skus and allowed product types.
*/
Expand Down Expand Up @@ -57,9 +59,18 @@ public function retrieveInvalidSkuList(array $skus, array $allowedProductTypes,

if ($allowedPriceTypeValue
&& $type == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
&& $this->productRepository->get($sku)->getPriceType() != $allowedPriceTypeValue
) {
$valueTypeIsAllowed = true;
try {
$product = $this->productRepository->get($sku);
if ($product->getPriceType() != $allowedPriceTypeValue) {
$valueTypeIsAllowed = true;
}
} catch (NoSuchEntityException $e) {
// Product was deleted between the ID lookup and repository fetch.
// Treat as invalid SKU so the rest of the batch continues.
$skuDiff[] = $sku;
break;
}
}

if (!in_array($type, $allowedProductTypes) || $valueTypeIsAllowed) {
Expand Down