Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Fixed an issue where an error would be thrown if a brand field didn't…
Browse files Browse the repository at this point in the history
… exist for a given Product Type

Signed-off-by: Andrew Welch <[email protected]>
  • Loading branch information
khalwat committed Mar 13, 2020
1 parent 5f9d58f commit 04a0e16
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/services/Commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,13 +467,8 @@ public function getProductDataFromProduct($productVariant = null): array
private function pullDataFromField($productVariant, $fieldHandle, $isBrand = false): string
{
$result = '';

if ($productVariant && $fieldHandle) {
$srcField = $productVariant[$fieldHandle];

if ($srcField === null) {
$srcField = $productVariant->product->$fieldHandle;
}
$srcField = $productVariant[$fieldHandle] ?? $productVariant->product[$fieldHandle] ?? null;
// If the source field isn't an object, return nothing
if (!is_object($srcField)) {
return $result;
Expand Down

0 comments on commit 04a0e16

Please sign in to comment.