Month: March 2022

WooCommerce Function of the Week: wc_get_customer_last_order

Two women window shopping

This week we’ll take a look at WooCommerce orders and a neat WooCommerce core function called wc_get_customer_last_order.

Nothing mysterious here — pass a customer ID, and with a PHP one-liner, you get immediately the customer’s latest order!

This can be used in several scenarios. Think for example of an email campaign that triggers six months after the customer’s last order to entice them to reorder. (In marketing, you’d call it a “Win-Back” campaign.)

But before looking at some case studies, let’s analyze the function syntax and source code.

Read more

Post Status Notes #489

App Store App

An App Store for WordPress.com? Performance Team Gathers Steam. WP Notify. FSE Beta. Block is Beautiful. Security, Plugin, Dev, Acquisitions.

Common Things Unite Us

Family gathering at festive table

This week I’ve been reflecting on the things that unite us as a community, as people, as family, and as friends. I think it comes down to common interests and the common good.

WooCommerce Function of the Week: wc_get_held_stock_quantity

A getting stock from a shelf in a warehouse.

Welcome back to WooCommerce Function of the Week! This week we cover a little hidden gem within the WooCommerce plugin code: wc_get_held_stock_quantity(). As the name suggests, this function helps you get the amount of stock present in pending orders for a given product.

If your store relies on careful stock management — maybe because you handle products with a small inventory — wc_get_held_stock_quantity is very useful. As orders come in for a limited number of products, you can take special action. Maybe you need to cancel those orders, or maybe you want to entice the customers placing them to complete their purchases before the item goes out of stock.

So, as usual, let’s first take a look at the function syntax and then consider a practical example of how you might use or display the returned value. Enjoy!

Read more

our sponsors

A2 Hosting
Omnisend
Kinsta
Progress Planner
Elementor
WP Munich
Atarim
Patchstack