WooCommerce.NET
WooCommerce.NET copied to clipboard
Sale price does not accepts null
When updating a Product, if the sale_price has any value and the new value is null, it does not update the sale_price. In debug, I have manualy changed the PROTECTED field "sale_priceValue" to an empty string and the slae_price DID update (to empty).
Is this the normal behavior? How can I solve this issue?
WooCommerceNET v. 0.8.2.0 WooCommerce v. 5.1.0
Try to use UpdateWithNull method
I have done it, but I beleive that by doing it that way, the number of API calls are multiplicated because sometimes we may want to change several properties with values and other times we may want to change those values to null and other times we may want to change some values with some actual values and other with null...
...unless I´m not understanding how to use UpdateWithNull.
Example: our product has a regular price and a sale price. If I want to update only the sale price and I already have one object with all information I need, then I need to UpdateWithNull, then Get the Product and then Update again.
Is this correct? If not...how should I do it?
If you set the SalePrice == RegularPrice it will clear the sale price.
OK. Did not knew about it. TY.