createOrder method

Future<WooOrder> createOrder(
  1. WooOrderPayload orderPayload
)

Creates an order and returns the WooOrder object.

Related endpoint: https://woocommerce.github.io/woocommerce-rest-api-docs/#orders.

Implementation

Future<WooOrder> createOrder(WooOrderPayload orderPayload) async {
  _printToLog('Creating Order With Payload : ' + orderPayload.toString());
  _setApiResourceUrl(
    path: 'orders',
  );
  final response = await post(queryUri.toString(), orderPayload.toJson());
  return WooOrder.fromJson(response);
}