woocommerce / woocommerce-rest-api

This is the WooCommerce core REST API Package. It runs standalone as a feature plugin too.
71 stars 46 forks source link

Delete custom fees from order #277

Closed ienzam closed 2 years ago

ienzam commented 2 years ago

It is not possible to remove fee_line for orders using the API.

For the line_items it is possible to set quantity to 0 or product_id to null, but that is not possible with fee_lines. I tried to set the whole value of fee_lines to null which did not remove anything and also changing total of order to 0 & remove name did not work.

Endpoint: wp-json/wc/v3/orders/632 Method: PUT Data:

{
 "fee_lines": [{ "id": "743", "name": "I cannot be deleted :-/", "total": 0 }],
 "line_items": [{ "id": "362", "name": "I can be deleted! :-)", "quantity": 0}]
}

Setting "name" to null doesn't work. The following error is returned:

{"code":"woocommerce_rest_invalid_fee_item","message":"Fee name is required.","data":{"status":400}}

This is a duplicate of #178, but that was closed.

ienzam commented 2 years ago

Seems like it's actually working, I made some mistake somewhere. Closing...