This simple snippet adds a single “Ready for Pickup” order status to WooCommerce. Perfect for stores that offer pickup services and need to notify customers when their orders are ready for collection.
The snippet creates a new order status called “Ready for Pickup” with a green color and package icon. When an order is changed to this status, the customer automatically receives an email notification.
/**
* Add "Ready for Pickup" custom order status to WooCommerce
* Simple single status with email notification
* Prefix: tpsc_ (TP Snippet Collection)
*/
// ============================================
// REGISTER CUSTOM ORDER STATUS
// ============================================
// Register "Ready for Pickup" order status
add_action('init', 'tpsc_register_ready_pickup_status');
function tpsc_register_ready_pickup_status() {
register_post_status('wc-ready-pickup', array(
'label' => 'Ready for Pickup',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('Ready for Pickup <span class="count">(%s)</span>', 'Ready for Pickup <span class="count">(%s)</span>'),
));
}
// ============================================
// ADD TO WOOCOMMERCE
// ============================================
// Add status to WooCommerce order statuses
add_filter('wc_order_statuses', 'tpsc_add_ready_pickup_status');
function tpsc_add_ready_pickup_status($order_statuses) {
$order_statuses['wc-ready-pickup'] = 'Ready for Pickup';
return $order_statuses;
}
// ============================================
// ADMIN STYLING
// ============================================
// Add custom styling for the status
add_action('admin_head', 'tpsc_ready_pickup_admin_styles');
function tpsc_ready_pickup_admin_styles() {
echo '<style>
mark.order-status.status-ready-pickup {
background-color: #27ae60 !important;
color: white !important;
}
mark.order-status.status-ready-pickup:before {
content: "📦 ";
margin-right: 3px;
}
.widefat .column-order_status mark.status-ready-pickup {
background-color: #27ae60;
border-radius: 4px;
padding: 4px 8px;
font-weight: bold;
}
</style>';
}
// ============================================
// BULK ACTIONS
// ============================================
// Add bulk action
add_filter('bulk_actions-edit-shop_order', 'tpsc_add_ready_pickup_bulk_action');
function tpsc_add_ready_pickup_bulk_action($bulk_actions) {
$bulk_actions['mark_ready_pickup'] = 'Mark as Ready for Pickup';
return $bulk_actions;
}
// ============================================
// ORDER ACTIONS
// ============================================
// Add order action in admin
add_filter('woocommerce_order_actions', 'tpsc_add_ready_pickup_order_action');
function tpsc_add_ready_pickup_order_action($actions) {
$actions['change_status_ready_pickup'] = 'Change status to Ready for Pickup';
return $actions;
}
// Process the order action
add_action('woocommerce_order_action_change_status_ready_pickup', 'tpsc_process_ready_pickup_action');
function tpsc_process_ready_pickup_action($order) {
$order->update_status('ready-pickup', 'Order status changed to Ready for Pickup by admin.');
}
// ============================================
// EMAIL NOTIFICATION
// ============================================
// Send email when status changes to ready-pickup
add_action('woocommerce_order_status_changed', 'tpsc_send_ready_pickup_email', 10, 3);
function tpsc_send_ready_pickup_email($order_id, $old_status, $new_status) {
if ($new_status !== 'ready-pickup') {
return;
}
$order = wc_get_order($order_id);
if (!$order) {
return;
}
// Get customer email
$customer_email = $order->get_billing_email();
if (!$customer_email) {
return;
}
// Email subject and message
$subject = sprintf('Your order #%s is ready for pickup!', $order->get_order_number());
$message = sprintf(
"Hello %s,\n\nGreat news! Your order #%s is now ready for pickup.\n\nOrder Details:\n- Order Number: #%s\n- Order Date: %s\n- Total: %s\n\nPlease visit our store to collect your order.\n\nThank you for your business!",
$order->get_billing_first_name(),
$order->get_order_number(),
$order->get_order_number(),
$order->get_date_created()->format('F j, Y'),
$order->get_formatted_order_total()
);
// Send email
wp_mail($customer_email, $subject, $message);
// Add order note
$order->add_order_note('Ready for pickup email sent to customer.');
}
// ============================================
// REPORTS INTEGRATION
// ============================================
// Include in WooCommerce reports
add_filter('woocommerce_reports_order_statuses', 'tpsc_include_ready_pickup_in_reports');
function tpsc_include_ready_pickup_in_reports($statuses) {
$statuses[] = 'ready-pickup';
return $statuses;
}
Something not working as expected? Need help customizing it for your specific needs?
Have an idea for functionality you're missing on your site? Tell us what you're looking for!
Share it with us! Our community loves learning and growing together.
No comments yet.