Skip to content

Commit

Permalink
Tweak SKU search keywords on products
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Oct 10, 2024
1 parent 4117834 commit a156731
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/elements/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,10 @@ public function getMetadata(): array
protected function searchKeywords(string $attribute): string
{
if ($attribute === 'sku') {
return $this->getVariants()->only('sku')->implode(' ');
return $this->getVariants()
->pluck('sku')
->filter(fn(?string $sku) => $sku && !PurchasableHelper::isTempSku($sku))
->implode(' ');
}

return parent::searchKeywords($attribute);
Expand Down

0 comments on commit a156731

Please sign in to comment.