From fa45071a5f7ae0c138a26ef18b57cca7e83a2340 Mon Sep 17 00:00:00 2001 From: Narek Zakarian Date: Fri, 8 Sep 2023 14:41:21 +0400 Subject: [PATCH] Don't send `image_url` when it is empty --- modules/ppcp-api-client/src/Entity/Item.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-api-client/src/Entity/Item.php b/modules/ppcp-api-client/src/Entity/Item.php index 7d38e5f78..cc739635f 100644 --- a/modules/ppcp-api-client/src/Entity/Item.php +++ b/modules/ppcp-api-client/src/Entity/Item.php @@ -249,9 +249,12 @@ class Item { 'sku' => $this->sku(), 'category' => $this->category(), 'url' => $this->url(), - 'image_url' => $this->image_url(), ); + if ( $this->image_url() ) { + $item['image_url'] = $this->image_url(); + } + if ( $this->tax() ) { $item['tax'] = $this->tax()->to_array(); }