bigcommerce / docs

The open source docs home for BigCommerce, including API specifications in OAS YAML and narrative docs in MDX
https://developer.bigcommerce.com
12 stars 29 forks source link

Feedback for “Orders” #520

Open cjbarth opened 5 days ago

cjbarth commented 5 days ago

For the "Update an Order" API: https://api.bigcommerce.com/stores/{store_hash}/v2/orders/{order_id}

The functionality to remove a product from an order is show in example like this: image

The documentations says similar: image

However, the following payload doesn't work:

{
    "products": [
        {
            "id": 3131,
            "product_id": 0,
            "quantity": 0,
            "product_options": [],
            "price_ex_tax": "0.0000",
            "price_inc_tax": "0.0000"
        }
    ]
}

When I call the "List Order Products" API: https://api.bigcommerce.com/stores/{{store_hash}}/v2/orders/{{order_id}}/products, I get the following payload:

[
    {
        "id": 3131,
        "order_id": 781,
        "product_id": 0,
        "variant_id": 0,
        "order_pickup_method_id": 0,
        "order_address_id": 926,
        "name": "ENGINEERING-10.01",
        "name_customer": "ENGINEERING-10.01",
        "name_merchant": "ENGINEERING-10.01",
        "sku": "",
        "upc": "",
        "type": "physical",
        "base_price": "0.0000",
        "price_ex_tax": "0.0000",
        "price_inc_tax": "0.0000",
        "price_tax": "0.0000",
        "base_total": "0.0000",
        "total_ex_tax": "0.0000",
        "total_inc_tax": "0.0000",
        "total_tax": "0.0000",
        "weight": "0.0000",
        "width": "0.0000",
        "height": "0.0000",
        "depth": "0.0000",
        "quantity": 0,
        "base_cost_price": "0.0000",
        "cost_price_inc_tax": "0.0000",
        "cost_price_ex_tax": "0.0000",
        "cost_price_tax": "0.0000",
        "is_refunded": false,
        "quantity_refunded": 0,
        "refund_amount": "0.0000",
        "return_id": 0,
        "wrapping_id": 0,
        "wrapping_name": "",
        "base_wrapping_cost": "0.0000",
        "wrapping_cost_ex_tax": "0.0000",
        "wrapping_cost_inc_tax": "0.0000",
        "wrapping_cost_tax": "0.0000",
        "wrapping_message": null,
        "quantity_shipped": 0,
        "event_name": null,
        "event_date": null,
        "fixed_shipping_cost": "0.0000",
        "ebay_item_id": "",
        "ebay_transaction_id": "",
        "option_set_id": null,
        "parent_order_product_id": null,
        "is_bundled_product": false,
        "bin_picking_number": "",
        "external_id": null,
        "fulfillment_source": "",
        "brand": "",
        "gift_certificate_id": null,
        "applied_discounts": [],
        "product_options": [],
        "configurable_fields": [],
        "discounted_total_inc_tax": "0.0000"
    },
    {
        "id": 3132,
        "order_id": 781,
        "product_id": 0,
        "variant_id": 0,
        "order_pickup_method_id": 0,
        "order_address_id": 926,
        "name": "ENGINEERING-10.01",
        "name_customer": "ENGINEERING-10.01",
        "name_merchant": "ENGINEERING-10.01",
        "sku": "",
        "upc": "",
        "type": "physical",
        "base_price": "0.0000",
        "price_ex_tax": "0.0000",
        "price_inc_tax": "0.0000",
        "price_tax": "0.0000",
        "base_total": "0.0000",
        "total_ex_tax": "0.0000",
        "total_inc_tax": "0.0000",
        "total_tax": "0.0000",
        "weight": "0.0000",
        "width": "0.0000",
        "height": "0.0000",
        "depth": "0.0000",
        "quantity": 1,
        "base_cost_price": "0.0000",
        "cost_price_inc_tax": "0.0000",
        "cost_price_ex_tax": "0.0000",
        "cost_price_tax": "0.0000",
        "is_refunded": false,
        "quantity_refunded": 0,
        "refund_amount": "0.0000",
        "return_id": 0,
        "wrapping_id": 0,
        "wrapping_name": "",
        "base_wrapping_cost": "0.0000",
        "wrapping_cost_ex_tax": "0.0000",
        "wrapping_cost_inc_tax": "0.0000",
        "wrapping_cost_tax": "0.0000",
        "wrapping_message": null,
        "quantity_shipped": 0,
        "event_name": null,
        "event_date": null,
        "fixed_shipping_cost": "0.0000",
        "ebay_item_id": "",
        "ebay_transaction_id": "",
        "option_set_id": null,
        "parent_order_product_id": null,
        "is_bundled_product": false,
        "bin_picking_number": "",
        "external_id": null,
        "fulfillment_source": "",
        "brand": "",
        "gift_certificate_id": null,
        "applied_discounts": [],
        "product_options": [],
        "configurable_fields": [],
        "discounted_total_inc_tax": "0.0000"
    }
]

So, as you can see, the items all match.

I get the following error:

<?xml version="1.0"?>
<errors>
    <error>
        <status>400</status>
        <message>
            <![CDATA[The field 'products.0.product_id' is invalid.]]>
        </message>
        <details>
            <invalid_reason>Product with id: 0 does not exist.</invalid_reason>
        </details>
    </error>
</errors>

If I remove product_id, I get what appears to be a successful update, but the product is never removed from the order. So, it appears that the documentation is missing something. Minimally, you can't simply put in whatever is returned from "List Order Products" because it returns a product_id of 0 and that isn't accepted by the API. How does one remove a product from an order? What else might I be missing?

cjbarth commented 5 days ago

Sorry, I posted this twice. For more information see #522 .