Merge pull request #1678 from woocommerce/PCP-1983-remove-item_url-from-API-request-when-product-has-no-image

Don't send `image_url` when it is empty (1983)
This commit is contained in:
Emili Castells 2023-09-08 15:35:58 +02:00 committed by GitHub
commit 74241dd147
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}