Orders

Create Orders Programmatically

In this tutorial we are going to dive deep into creating an order on your WooCommerce store completely via code. I already have a similar tutorial on my blog where we created a product programmatically.

First things first, you should know a very simple thing – yeah, orders is a WordPress custom post type and no, we can not use wp_insert_post() to create them. We have to use a CRUD layer for that. If it says nothing to you, please be patient, we’re going to dive into it in just a little bit.

Order Items

Welcome to a complete tutorial about WooCommerce order items. Here we are going to talk about how to work with order items in code and then I have a very interesting real life example for you.

Add Order Meta to Emails

We already discussed on my blog how to add custom order meta to view order page or to order details metabox in WooCommerce admin. It is time to add the same custom fields to WooCommerce emails.

We are going to use primary woocommerce_email_order_meta action hook for that. There is also another hook – woocommerce_email_order_meta_fields, we will also take a look on it, but I recommend you the first one.

Bulk Change Custom Order Status

A couple tutorials ago we created a custom order status. There were a lot of questions in comments section about adding it to bulk actions.

Let’s do it now.

To add anything into bulk actions dropdown we need to use bulk_action-{screen id}. A little more details about it is in bulk actions tutorial. But now when we are going to use it for orders page, its screen id will be edit-shop_order. So, the hook is going to be bulk_action-edit-shop_order.

Create a Custom Order Status