Woocommerce Rest API returns an order with customer_id of 0
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
Asked
Viewed
5 times
Viewing an order in wordpress under woocommerce shows the order has a customer assigned to it. Getting the order via woocommerce rest api shows a customer_id of 0.
{#1738 ▼
+"id": 62
+"parent_id": 0
+"status": "processing"
+"currency": "ZAR"
+"version": "5.9.0"
+"prices_include_tax": false
+"date_created": "2021-11-17T06:33:37"
+"date_modified": "2021-11-17T06:33:38"
+"discount_total": "0.00"
+"discount_tax": "0.00"
+"shipping_total": "0.00"
+"shipping_tax": "0.00"
+"cart_tax": "0.00"
+"total": "130.05"
+"total_tax": "0.00"
+"customer_id": 0
+"order_key": "wc_order_M2plv7e86bYFu"
+"billing": {#1729 ▶}
+"shipping": {#1751 ▶}
+"payment_method": "cheque"
+"payment_method_title": "Check payments"
+"transaction_id": ""
+"customer_ip_address": ""
+"customer_user_agent": ""
+"created_via": "rest-api"
+"customer_note": ""
+"date_completed": null
+"date_paid": "2021-11-17T06:33:38"
+"cart_hash": ""
+"number": "62"
+"meta_data": array:1 [▶]
+"line_items": array:5 [▶]
+"tax_lines": []
+"shipping_lines": array:1 [▶]
+"fee_lines": []
+"coupon_lines": []
+"refunds": []
+"date_created_gmt": "2021-11-17T06:33:37"
+"date_modified_gmt": "2021-11-17T06:33:38"
+"date_completed_gmt": null
+"date_paid_gmt": "2021-11-17T06:33:38"
+"currency_symbol": "R"
+"_links": {#1743 ▶}
}
Totally clueless why this is happening. Is there a setting that needs to be set, maybe.
chaulap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
lang-php

Leave an answer