updateProduct() method should check for read only fields and exclude them
Currently it looks like below
vendor/bigcommerce/api/src/Bigcommerce/Api/Client.php:398
/**
* Update the given product.
*
* @param int $id product id
* @param mixed $object fields to update
*/
public static function updateProduct($id, $object)
{
return self::updateResource('/products/' . $id, $object);
}
I suggest adding code which will exclude fields mentioned in \BigCommerce\Api\Resources\Product::$ignoreOnUpdate array
Also imagine I want to clear my object from fields which are read only.
Just because API will thrown an Error to me
I want to get the list of properties to exclude, I would like to get them from current Bigcommerce API library. I could create empty \BigCommerce\Api\Resources\Product instance and get it's $ignoreOnUpdate property, but it's protected, so I can not do it.
so I propose making that field static and add new static method
protected static $ignoreOnUpdate = array('id', 'rating_total', 'etc...');
public static function getReadOnlyFields() {
return self::$ignoreOnUpdate;
}
this will require code update in other places where $ingoreOnUpdate field was used, but I can make it myself given I have a green light.