WooCommerce.NET
WooCommerce.NET copied to clipboard
UpdateRange blocks the application
Wordpress version 5.7.1, WooCommerce version 5.2.2 and WooCommerce.NET version 2.0
When I try to update stock, with this code: Product p = new Product() { id=27, stock_quantity = 222, manage_stock = true, }; //var a = wc.Product.Update(Convert.ToInt32(p.id),p).Result; List<Product> ps = new List<Product>(); ps.Add(p); WooCommerceNET.Base.BatchObject<Product> psbo = new WooCommerceNET.Base.BatchObject<Product>(); psbo.update = ps;
var a = wc.Product.UpdateRange(psbo).Result;
The application stalled. The stock is updated, but I have to stop killing the task
Your problem does not lie with WooCommerce.NET but with how you're coding your application. I'd suggest reading up on asynchronous programming.