• Hello

    If we place a order for a product with price 190 and quantity 3 then total amount is 570 then if we apply a coupon which gives 20 rs discount then total amount is 550
    And we are getting the error: Expected an int but was 143.333333333333342807236476801335811614990234375 at path $.line_items[0].price
    How to solve this error?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Riaan K.

    (@riaanknoetze)

    Hi there,

    WooCommerce doesn’t have a “place order” API – the closest is “Create Order” as outlined at https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order. Is that what you’re referring to?

    If so, can you share a bit more on how that query is constructed?

    Thread Starter chandan435

    (@chandan435)

    Yes I’m referring to Create Order API. Here is my query structure: {
    “payment_method”: “bacs”,
    “payment_method_title”: “Direct Bank Transfer”,
    “currency”:”INR”,
    “set_paid”: true,
    “transaction_id”:””,
    “customer_id”:14,
    “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”
    },
    “shipping”: {
    “first_name”: “John”,
    “last_name”: “Doe”,
    “address_1”: “969 Market”,
    “address_2”: “”,
    “city”: “San Francisco”,
    “state”: “CA”,
    “postcode”: “94103”,
    “country”: “US”
    },
    “line_items”: [
    {
    “product_id”: 8166,
    “quantity”: 2,
    “total”:””
    }
    ],
    “coupon_lines”:[
    {
    “code”:”5BW74VGS”
    }
    ]

    }

    The values are just place holders

    Thanks

    Thread Starter chandan435

    (@chandan435)

    Hello @riaanknoetze

    `“payment_method”: “bacs”,
    “payment_method_title”: “Direct Bank Transfer”,
    “currency”:”INR”,
    “set_paid”: true,
    “transaction_id”:””,
    “customer_id”:14,
    “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”
    },
    “shipping”: {
    “first_name”: “John”,
    “last_name”: “Doe”,
    “address_1”: “969 Market”,
    “address_2”: “”,
    “city”: “San Francisco”,
    “state”: “CA”,
    “postcode”: “94103”,
    “country”: “US”
    },
    “line_items”: [
    {
    “product_id”: 8166,
    “quantity”: 2,
    “total”:””
    }
    ],
    “coupon_lines”:[
    {
    “code”:”5BW74VGS”
    }
    ]

    }

    The values are just place holders

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Error in Woocommerce Place Order API’ is closed to new replies.