In WooCommerce, an order (post type order
) stores a variety of data that is essential for order processing and management. Here are the main categories of data that an order object (WC_Order
) can contain:
- Basic Order Data:
ID
: unique identifier for the order in the database.post_date
: date and time when the order was created.post_status
: order status (e.g.,wc-pending
,wc-completed
,wc-processing
,wc-cancelled
, etc.).post_title
: order title (typically a combination of the order ID and customer name).post_modified
: date when the order was last modified.
- Customer Data:
billing_first_name
,billing_last_name
: customer’s first and last name.billing_address_1
,billing_address_2
: customer’s billing address.billing_city
: customer’s city.billing_postcode
: customer’s postal code.billing_country
: customer’s country.billing_state
: customer’s region/state.billing_phone
: customer’s phone number.billing_email
: customer’s email address.shipping_first_name
,shipping_last_name
: first and last name for shipping.shipping_address_1
,shipping_address_2
: shipping address.shipping_city
: shipping city.shipping_postcode
: shipping postal code.shipping_country
: shipping country.shipping_state
: shipping region/state.
- Shipping Data:
shipping_method
: shipping method (e.g.,flat_rate
,free_shipping
).shipping_total
: shipping cost.shipping_tax
: shipping tax.
- Payment Data:
payment_method
: payment method (e.g.,stripe
,paypal
).payment_method_title
: payment method title (e.g.,Credit Card
).transaction_id
: transaction ID.order_total
: total order amount.order_tax
: total tax on the order.coupon_lines
: information about applied coupons.
- Order Items:
- A list of items in the order, containing for each item:
product_id
: product ID.quantity
: quantity of the product.total
: item cost excluding tax.subtotal
: product price before any discounts.meta_data
: product metadata (e.g., color, size, and other attributes).
- A list of items in the order, containing for each item:
- Order History:
order_notes
: notes left by administrators or users for the order.order_status_history
: history of the order’s status changes.
- Discounts and Taxes:
discount_total
: total discount amount.discount_tax
: tax amount on the discount.tax_lines
: information about taxes applied to the order.
- Other Data:
customer_id
: user ID (if the purchase is made by a registered user).customer_ip_address
: customer’s IP address.customer_user_agent
: user agent (browser information).created_via
: how the order was created (e.g., via the website or API).refunded_amount
: refunded amount.
These data can be retrieved and updated using the WooCommerce API and functions like WC_Order
and order meta functions.