Orders – Page 3

How to Run Heavy Functions on Repeatable Action Hooks

Sometimes when you’re using some hooks, for example save_post, you may notice that functions connected to those hook may be fired twice, for example it happens when you’re using outdated metaboxes instead of Gutenberg plugin sidebars.

But there is no need to worry about save_post hook because it can be fixed pretty easily – depending whether you’re using the Block Editor or not, just create meta fields the appropriate way and it fixes everything… it is woocommerce_update_order hook I am worried about.

When you create or update a WooCommerce order, the woocommerce_update_order action hook is going to be fired multiple times and at least it may create performance issues.

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.

Order Lifecycle Hooks in WooCommerce

As you probably know WooCommerce (or Woo, how should we call it today?) is packed with hooks. And sometimes when you’re creating a custom plugin for WooCommerce or even building a theme, it could be quite overwhelming to figure out which one of the hooks is better to use for your specific purpose.

The good news is – I have described every situation in this tutorial!

How to Add Custom Fields to Order Details Page

In this tutorial I am going to talk about customers order details page, that is located in My Account > Orders > View Order. In case you are looking for a solution how to add custom fields to edit order page in WordPress admin, there is a separate tutorial for that.

Add Fields to Edit Order Page

First things first, if you need to display custom fields in View Order page in My Account, you need another tutorial. In this tutorial we are going to do it in WordPress admin only.

Here is what we are going to create:

Add custom editable information to the Order Details

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.