kloon / WooCommerce-REST-API-Client-Library

A PHP wrapper for the WooCommerce REST API
GNU General Public License v3.0
356 stars 175 forks source link

Query #229

Open sufian4199 opened 7 years ago

sufian4199 commented 7 years ago

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

crushman1 commented 7 years ago

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" notifications@github.com 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 .

SetareMaghari commented 7 years ago

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' => 'john.doe@example.com',
    '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);