Orders


Overview

The orders API allows you to view individual or a batch of products.


Create a new Order in WooCommerce

This method can be used to create new orders in WooCommerce

createOrder()

Parameters

OrderWC orderWC, // Create an instance of OrderWC and set all the parameters in the object

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    OrderWC orderWC = OrderWC();
    orderWC.setPaid = true;
    orderWC.lineItems = [];
    ...

    wcStore.createOrder(orderWC).then( (order) {
        print(order);
    });

});

Response

Order instance

Represents the following object - WooCommerce order created

List all orders

Returns orders back from WooCommerce, include parementers to query data.

getOrders()

Parameters

int page,
int perPage,
String search,
String after,
String before,
List<int> exclude,
List<int> include,
int offset,
String order,
String orderBy,
List<int> parent,
List<int> parentExclude,
List<String> status,    // Options: any, pending, processing, on-hold, completed, cancelled, refunded, failed and trash. Default is any.
int customer,
int product,
int dp

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.getOrders().then( (orders) {
        print(orders);
    });

});

Response

List<Order> instance

Represents the following object - WooCommerce list all orders

Retrieve a order by it's ID

getOrders()

Parameters

int id,

String dp, // (Optional) Number of decimal points to use in each resource.

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.retrieveOrder(id: "order id").then( (order) {
        print(order);
    });

});

Response

Order instance

Represents the following object - WooCommerce retrieve order


Delete an order

This API helps you delete an order.

deleteOrder(int id)

Parameters

int id,
bool force = true

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
    wcStore.deleteOrder(
    int id,
  {bool force = true}
  ).then((orders){
        print(orders.toJson());
    });
});

Response

Orders instance

Represents the following object - WooCommerce orders


Batch update orders

This API helps you to batch create, update and delete multiple orders.

batchOrders({ data })

Parameters

int id,
bool force = true

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
    wcStore.batchOrders({Map<String, dynamic> data}).then((orders){
        print(orders.toJson());
    });
});

Response

OrderBatch instance

Represents the following object - WooCommerce order batch