laravel-google-merchant-api icon indicating copy to clipboard operation
laravel-google-merchant-api copied to clipboard

product update

Open dr-roshyara opened this issue 2 years ago • 0 comments

I didn't understand how to update a product. Would you please write an example to update a product availability in google merchant? Can it be something like :

$attributes = [
    'id' => 1, // maps to offerId (if set in config)
    'name' => 'Product 1', // likewise maps to title
];
$params = [
  price =>[
   'currency'=>'EUR' ,
   'value'=>200
]
];
ProductApi::update(function($product) use($attributes){
    $product->with($attributes)
    ->inStock($inStock = false);
}, $params )->then(function($data){
    echo 'Product updated';
})->otherwise(function(){
    echo 'Insert failed';
})->catch(function($e){
    dump($e);
});

dr-roshyara avatar Feb 22 '23 08:02 dr-roshyara