Eugene Eugene - 3 months ago 15
C# Question

WooCommerce Adress error (C# UWP)

I try to receive data from WC like this

RestAPI rest = new RestAPI("http://simplegames.com.ua/wp-json/wc/v1/", "ck_9d64c027d2c5f81b8bed3342eeccc6d337be813d", "cs_60697b1e6cbdeb8d62d19e0765e339f8e3334754");

WCObject wc = new WCObject(rest);
//Get all products
var orders = await wc.GetOrders();


foreach (var order in orders) {
Debug.WriteLine($"Currency: {order.currency},Date:{order.date_created},Adress: {order.shipping}, Total Cost: {order.total}");
}


In this code all okay.

But I have this in output
Adress: WooCommerceNET.WooCommerce.ShippingAddress


Why I don't see adress?

Answer

I'm assuming you need to access each individual line of the address rather than it being nicely formatted into a single line. Without going through the source of the plugin, something similar to order.shipping.streetname, order.shipping.town may be the solution.