M
M
MrDoSSSS2016-11-21 22:20:08
WooCommerce
MrDoSSSS, 2016-11-21 22:20:08

How to setup woocommerce rest api?

Hello! Such a question, how to setup connection to woocommerce rest api using "WooCommerce API - PHP Client"? It doesn't work at all.
I set it up using "WooCommerce-REST-API-Client-Library", but I get JSON in the form

stdClass Object
    (
        [orders] => Array
            (
                [0] => stdClass Object
                    (
                        [id] => 91
                        [order_number] => 91
                        [created_at] => 2016-11-21T09:25:23Z
                        [updated_at] => 2016-11-21T09:25:23Z
                        [completed_at] => 2016-11-21T09:25:23Z
                        [status] => processing
                        [currency] => RUB
                        [total] => 720.00
                        [subtotal] => 720.00
                        [total_line_items_quantity] => 1
                        [total_tax] => 0.00
                        [total_shipping] => 0.00
                        [cart_tax] => 0.00
                        [shipping_tax] => 0.00
                        [total_discount] => 0.00
                        [shipping_methods] => 
                        [payment_details] => stdClass Object
                            (
                                [method_id] => cod
                                [method_title] => Наложенный платеж
                                [paid] => 
                            )

                        [billing_address] => stdClass Object
                            (
                                [first_name] => ...
                                [last_name] => 
                                [company] => 
                                [address_1] => ...
                                [address_2] => 
                                [city] => ...
                                [state] => 
                                [postcode] => 
                                [country] => RU
                                [email] => 
                                [phone] => ...
                            )

I don't understand much about JSON, but I need to get something like:
[
      {
        "id": 154,
        "parent_id": 0,
        "status": "processing",
        "order_key": "wc_order_574cc02467274",
        "number": "154",
        "currency": "USD",
        "version": "2.6.0",
        "prices_include_tax": false,
        "date_created": "2016-05-30T22:35:16",
        "date_modified": "2016-05-30T22:35:16",
        "customer_id": 0,
        "discount_total": "0.00",
        "discount_tax": "0.00",
        "shipping_total": "10.00",
        "shipping_tax": "0.00",
        "cart_tax": "1.95",
        "total": "37.95",
        "total_tax": "1.95",
        "billing": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US",
          "email": "[email protected]",
          "phone": "(555) 555-5555"
        },
        "shipping": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        },

Perhaps this can be achieved using the "WooCommerce API - PHP Client", but it can not be configured ..
PS: all this is needed for parsing orders in unity, and pure JSON is needed there. If there are options how to connect to the woocommerce rest api directly from c#, please tell me.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question