fix: handle missing product variants gracefully in applyPayloadToProduct method
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (8.3) (push) Waiting to run
tests / ci (8.4) (push) Waiting to run
tests / ci (8.5) (push) Waiting to run

This commit is contained in:
Yoga Pangestu 2026-07-28 15:38:40 +07:00
parent 1d5863efaf
commit d316266da7

View File

@ -543,7 +543,11 @@ private function applyPayloadToProduct(
foreach ($payload['variants'] ?? [] as $index => $variantData) {
if (! empty($variantData['id'])) {
$variant = $product->variants()->findOrFail($variantData['id']);
$variant = $product->variants()->find($variantData['id']);
if ($variant === null) {
continue;
}
$this->recordVariantStockChanges($variant, $variantData);