diff --git a/src/LukeSnowden/GoogleShoppingFeed/Item.php b/src/LukeSnowden/GoogleShoppingFeed/Item.php index 9153a7e..e707a10 100644 --- a/src/LukeSnowden/GoogleShoppingFeed/Item.php +++ b/src/LukeSnowden/GoogleShoppingFeed/Item.php @@ -444,7 +444,7 @@ protected function getGroupIdentifier() */ public function cloneIt() { - $groupIdentifiers = $this->getGroupIdentifier(); + $groupIdentifiers = $this->getGroupIdentifier(); /** @var Item $item */ $item = $this->googleShoppingFeed->createItem(); $this->item_group_id( $groupIdentifiers ); @@ -462,7 +462,14 @@ public function cloneIt() } } } elseif ($node->get('name') !== 'shipping') { - $item->{$node->get('name')}($node->get('value')); + if (method_exists($item->{$node->get('name')})) { + $item->{$node->get('name')}($node->get('value')); + return $item; + } + + if (!method_exists($item->{$node->get('name')})) { + $item->custom($node->get('name'), ($node->get('value'))); + } } } return $item;