WooCommerce-REST-API-Client-Library icon indicating copy to clipboard operation
WooCommerce-REST-API-Client-Library copied to clipboard

Query

Open sufian4199 opened this issue 7 years ago • 2 comments

Can you share a list of all supported queries? Specifically looking for how to add a new order via the api

sufian4199 avatar Jul 27 '17 14:07 sufian4199

Y cant i unsubscribe to this? I have tried unsubscribing a million times now. Please un sub me from this thread and all other threads

On Jul 27, 2017 10:09 AM, "sufian4199" [email protected] wrote:

Can you share a list of all supported queries? Specifically looking for how to add a new order via the api

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kloon/WooCommerce-REST-API-Client-Library/issues/229, or mute the thread https://github.com/notifications/unsubscribe-auth/AG_2L4lRNV6Bh0LIcpPbOsmborZfZCD-ks5sSJoigaJpZM4OlVnD .

crushman1 avatar Jul 27 '17 16:07 crushman1

hi, if you want to make order, you have to make an array first(as mentioned in woocommerce API in this link: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order)

` $data = [

'customer_id' => 1,
'billing' => [
    'first_name' => 'John',
    'last_name' => 'Doe',
    'address_1' => '969 Market',
    'address_2' => '',
    'city' => 'San Francisco',
    'state' => 'CA',
    'postcode' => '94103',
    'country' => 'US',
    'email' => '[email protected]',
    'phone' => '(555) 555-5555'
],
'line_items' => [
    [
        'product_id' => 79,
        'quantity' => 2
    ],
    [
        'product_id' => 73,
        'quantity' => 1
    ]
]

];

`

and then call this method:

$client->orders->create($data);

SetareMaghari avatar Aug 02 '17 12:08 SetareMaghari