WooCommerce.NET icon indicating copy to clipboard operation
WooCommerce.NET copied to clipboard

UpdateRange blocks the application

Open Prtec opened this issue 3 years ago • 1 comments

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

Prtec avatar Apr 22 '21 15:04 Prtec

Your problem does not lie with WooCommerce.NET but with how you're coding your application. I'd suggest reading up on asynchronous programming.

firestormza avatar May 03 '21 05:05 firestormza