$purchasePricesCollection =
$product->
getPurchasePrices();
if ($purchasePricesCollection !== null
) { $purchasePrices =
$purchasePricesCollection->
getCurrencyPrice(Defaults::CURRENCY
);
} $payload =
[ 'isCloseout' =>
$product->
getIsCloseout(),
'customFields' =>
$product->
getCustomFields(),
'createdAt' =>
$product->
getCreatedAt() ?
$product->
getCreatedAt()->
format(Defaults::STORAGE_DATE_TIME_FORMAT
) : null,
'releaseDate' =>
$product->
getReleaseDate() ?
$product->
getReleaseDate()->
format(Defaults::STORAGE_DATE_TIME_FORMAT
) : null,
'isNew' =>
$product->
isNew(),
'markAsTopseller' =>
$product->
getMarkAsTopseller(),
'purchasePrices' =>
$purchasePrices ?
json_encode($purchasePrices, \JSON_THROW_ON_ERROR
) : null,
'productNumber' =>
$product->
getProductNumber(),
'manufacturerId' =>
$product->
getManufacturerId(),
'taxId' =>
$product->
getTaxId(),
'tagIds' =>
$product->
getTagIds(),
'categoryIds' =>
$product->
getCategoryTree(),
'propertyIds' =>
$product->
getPropertyIds(),
'optionIds' =>
$product->
getOptionIds(),
'options' =>
$product->
getVariation(),
'streamIds' =>
$product->
getStreamIds(),
'parentId' =>
$product->
getParentId(),