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

Update order Error

Open mnieblab opened this issue 4 years ago • 4 comments

Make sure you have included the below details when open an issue. Thank you.

  • Wordpress version: 5.4.2, WooCommerce version: 4.3.1 and WooCommerce.NET version: 0.8.2

I use the this code: RestAPI apiConnect = new RestAPI(UrlWS, User, PassUser); WCObject objetoPedido = new WCObject(apiConnect); int id = Convert.ToInt32(idPedido); Order pedido = await objetoPedido.Order.Get(id);
pedido.status = "processing";
Order resultado = await objetoPedido.Order.Update(id, pedido);

the error: {"code":"rest_invalid_param","message":"Par\u00e1metro(s) no v\u00e1lido(s): fee_lines","data":{"status":400,"params":{"fee_lines":"fee_lines[0][total_tax] no es del tipo string."}}}

The difference is that I am using the plugin WooCommerce Pay for Payment to apply an extra charge depending on the type of payment used. Can you help me, thanks

mnieblab avatar Jul 26 '20 15:07 mnieblab

If you only want to change the order status, please use UpdateWithNull function.

XiaoFaye avatar Jul 26 '20 20:07 XiaoFaye

If you only want to change the order status, please use UpdateWithNull function.

I'd like to do it, but the status isn't being changed at all

NickDomanti avatar Oct 09 '20 07:10 NickDomanti

If you only want to change the order status, please use UpdateWithNull function.

I tried this but i get "object reference not set to an instance of an object"

Any ideas?

Update: this worked for me https://github.com/XiaoFaye/WooCommerce.NET/issues/42#issuecomment-256442899

Tinchio avatar Oct 23 '20 20:10 Tinchio

I want to say that for me the solution has been the solution of Mnieblab

string result = await wc.UpdateOrder (oid, new Order { status= "cancelled" })

Actually i used V3 and 0.82 version of woocomerce.net

Thanks a lot to all.

IcuScc avatar Oct 20 '21 08:10 IcuScc