Skip to content

Commit

Permalink
Merge branch 'fix/77'
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasfabian committed May 13, 2024
2 parents 6a98f90 + 843238e commit 13eee2c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/ProductList.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ public function __set(string $key, $value): void
$value['uid'] = $page->uid();
}
foreach (option('ww.merx.cart.fields', []) as $fieldName) {
$field = $page->{$fieldName}();
if (
$field === null ||
is_scalar($field) ||
is_string($field) ||
(is_object($field) && method_exists($field, '__toString'))
) {
$value[$fieldName] = (string)$field;
if (!array_key_exists($fieldName, $value)) {
$field = $page->{$fieldName}();
if (
$field === null ||
is_scalar($field) ||
is_string($field) ||
(is_object($field) && method_exists($field, '__toString'))
) {
$value[$fieldName] = (string)$field;
}
}
}
}
Expand Down

0 comments on commit 13eee2c

Please sign in to comment.