How to display data from Woocomerce Api call?

谁说我不能喝 提交于 2021-01-28 21:21:36

问题


I have UWP app which downloads data from woocomerce.

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 products = await wc.GetOrders();

Debug.WriteLine(products);

I try to display data to Console.

Debug shows name of method, how I can show data that I downloaded?


回答1:


So, let's start

//Get all products
var products = await wc.GetOrders();

You retrieve OrderList object type, which derives from List<Order>. It means, that you need get data per each item

foreach (var order in products)
{

}

In order item you have all required data, which you need. For example:

Debug.WriteLine($"Currency: {order.currency}, Total Tax: {order.total_tax}");

I hope, you will find way how retrieve other data from order item



来源:https://stackoverflow.com/questions/38918908/how-to-display-data-from-woocomerce-api-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!