What data can a post type order WooCommerce store?

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:

  1. 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.
  2. 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.
  3. Shipping Data:
    • shipping_method: shipping method (e.g., flat_rate, free_shipping).
    • shipping_total: shipping cost.
    • shipping_tax: shipping tax.
  4. 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.
  5. 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).
  6. Order History:
    • order_notes: notes left by administrators or users for the order.
    • order_status_history: history of the order’s status changes.
  7. Discounts and Taxes:
    • discount_total: total discount amount.
    • discount_tax: tax amount on the discount.
    • tax_lines: information about taxes applied to the order.
  8. 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.

How useful is the publication?

Click on a star to rate it!

Average score 5 / 5. Number of grades: 1

No ratings yet. Rate it first.

Similar posts

Which post_types are reserved in WordPress?

In WordPress, there are several reserved post types that the system uses to store and organize content. Here are the main ones: In addition to these standard types, WordPress allows you to create your own custom post types, for example, for products in an online store, events, or other entities needed in your project. Important…
Read more

WordPress Template Hierarchy full guide

A guide to the template hierarchy in WordPress All modern WordPress themes consist of templates, style sheets, javascript, and images. Together, these files determine how your site will look to users. Templates with specific names affect certain areas of your website. Generally, a WordPress theme should contain templates for displaying categories, dates, archives, individual posts,…
Read more

What are plugins in WordPress and how do they work?

If you’re new to WordPress, you’re probably asking yourself: “What are plugins in WordPress?” This is a fairly common question because, in addition to introducing one of many new terms into your vocabulary, WordPress plugins are also an important building block of every single WordPress site. This article will answer your question, and then we’ll…
Read more