Have questions? Leave your message here or Schedule a quick call with our manager now

How to work with orders?

Order API methods allow you to manage orders in the store. It is possible to:

  • Create - add orders
  • Read - retrieve list, info, find
  • Update - update
  • Delete - delete

Run order.add method to add orders to the store, and provide all necessary parameters.

public function apiAdd($params)
{
  $params = array(
    'customer_email'         => '[email protected]',
    'order_status'           => 'Complete',
    'bill_first_name'        => 'Adam',
    'bill_last_name'         => 'Smith',
    'bill_address_1'         => 'Green str. 35',
    'bill_city'              => 'Chicago',
    'bill_postcode'          => '12345',
    'bill_state'             => 'IL',
    'bill_country'           => 'US',
    'total_price'            => '23.56',
    'order_item_id_1'        => 8,
    'order_item_name_1'      => 'Bag',
    'order_item_model_1'     => 'bag_01',
    'order_item_price_1'     => 89,
    'order_item_quantity_1'  => 3,
  );

  return = $api->request('order.add', $params);
}

If you want to update an order, call order.list method to get order id.

public function apiList($params)
{
  $params = array(
    'start'  => 0,
    'count'  => 5,
    'params' => 'id,customer,status'
  );

  return $api->request('order.list', $params);
}

When you get your order id, you are able to update comment and order status by calling  order.update method

public function apiUpdate($params)
{
  $params = array(
    'order_id'     => 11,
    'order_status' => 'Pending',
    'comment'      => 'Order comment'
  );

  return $api->request('order.update', $params);//returns the number of updated orders
}

Note: You are able to count orders in the store by calling order.count method.

For more methods jump into documentation.

Posted in: Getting Started