1

PHP 言語を使用して、Google Content API for Shopping を介して、Google Merchant フィードの商品販売価格を更新 (別の価格に変更)できます。

例。40% 割引の製品 (元の価格 = 100.00 ユーロ、販売価格 = 60.00 ユーロ):

$product = new Google_Service_ShoppingContent_Product();
$product->setOfferId($myProductId);
$product->setContentLanguage($idData[1]);
$product->setTargetCountry($idData[2]);
$product->setChannel($idData[0]);

$price = new Google_Service_ShoppingContent_Price();
$price->setValue(100.00);
$price->setCurrency('EUR');

$product->setPrice($price);

$salePrice = new Google_Service_ShoppingContent_Price();
$salePrice->setValue(60.00);
$salePrice->setCurrency('EUR');

$product->setSalePrice($salePrice);

この割引を取り消すことができません。製品の最終価格を 100.00 ユーロに戻したいです。私は試しました:

$product->setSalePrice(NULL);

しかし、致命的なエラーが発生しました:

Google_Service_ShoppingContent_Product::setSalePrice() に渡される引数 1 は、Google_Service_ShoppingContent_Price のインスタンスでなければなりません

値を0に設定してみました

$salePrice = new Google_Service_ShoppingContent_Price();
$salePrice->setValue(0.00);
$salePrice->setCurrency('EUR');

しかし、Google は私の申し出を承認しません。

これどうやってするの?

前もって感謝します

4

1 に答える 1