This document explains the main hooks and filters available in WooCommerce Pre-Orders, with practical examples you can adapt for your store.
If you are looking for merchant setup guidance, see WooCommerce Pre-Orders documentation.
For general WooCommerce hook fundamentals, see Introduction to hooks, actions, and filters and WooCommerce actions and filters.
Note:
This is a developer-level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customization work. We are unable to provide support for customization under our Support Policy.
Scope of support:
We are unable to provide support for customizations under our Support Policy. If you need to customize a snippet or extend its functionality, we recommend working with a Woo Agency Partner or a WooCommerce developer on Codeable.
Add examples to a site-specific plugin on a staging store with WooCommerce Pre-Orders active. Use a product with pre-orders enabled. Use your payment provider’s test mode for any checkout or release test.
How Pre-Orders Hooks Are Used
↑ Back to topPre-Orders uses both actions and filters throughout product display, checkout, status transitions, and admin workflows.
- Filters let you modify values such as availability date text, supported product types, or gateway lists.
- Actions let you react to events such as a status change, release date change, completion, or cancellation.
Key Filters
↑ Back to top| Filter | Purpose |
|---|---|
wc_pre_orders_localized_availability_date | Customize the formatted availability date shown on the frontend |
wc_pre_orders_localized_availability_time | Customize the formatted availability time shown on the frontend |
wc_pre_orders_get_utc_availability_datetime_timestamp | Adjust raw UTC timestamp before localization |
wc_pre_orders_product_message | Customize pre-order product messaging |
wc_pre_orders_product_can_be_pre_ordered | Control whether a product can currently be pre-ordered |
wc_pre_orders_product_supports_pre_order_feature | Control whether a product can support pre-orders at all |
wc_pre_orders_supported_product_types | Add or remove globally supported product types |
wc_pre_orders_remove_unsupported_gateways | Modify available gateways during pre-order checkout |
wc_pre_orders_fee | Modify pre-order fee label/amount/tax setup |
wc_pre_orders_cart_item_meta | Customize cart/checkout pre-order metadata row |
Key Actions
↑ Back to top| Action | Purpose |
|---|---|
wc_pre_order_status_changed | Runs on every pre-order status transition |
wc_pre_order_status_{new_status} | Runs when status is updated to a specific value |
wc_pre_order_status_{old_status}_to_{new_status} | Runs on a specific from/to transition |
wc_pre_orders_pre_order_date_changed | Runs when a release date is changed |
wc_pre_orders_pre_order_completed | Runs when a pre-order is completed |
wc_pre_orders_pre_order_cancelled | Runs when a pre-order is canceled |
wc_pre_orders_process_pre_order_completion_payment_{gateway_id} | Runs gateway-specific payment logic during completion |
wc_pre_orders_release_payment_charged | Fires after a release payment is recorded. Passes the order and gateway transaction ID. |
Starting with Pre-Orders 2.3.8, wc_pre_orders_release_payment_charged passes a WC_Order and the transaction ID as a string. The ID can be empty if the gateway did not supply one. A gateway can use this action to discard the order-scoped payment token after the release charge. The separate completion action reports that the pre-order completed. A pre-order can complete without a release payment, such as when it was paid upfront.
Availability Date Example
↑ Back to topUse this filter to customize how {availability_date} appears to customers. Test a product with an availability date and a product without one.
add_filter(
'wc_pre_orders_localized_availability_date',
function ( $formatted_date, $product ) {
$timestamp = WC_Pre_Orders_Product::get_utc_availability_datetime_timestamp( $product );
if ( ! $timestamp ) {
return $formatted_date;
}
return wp_date( 'D, M j, Y', $timestamp, wp_timezone() );
},
10,
2
);
The example uses the store’s WordPress time zone and keeps the original value when the product has no availability timestamp.
Product Eligibility Example
↑ Back to topThis example makes a pre-order product ineligible for a guest. Check product eligibility while signed out and while signed in. The filter preserves an ineligible result for signed-in customers.
add_filter(
'wc_pre_orders_product_can_be_pre_ordered',
function ( $can_be_pre_ordered ) {
return $can_be_pre_ordered && is_user_logged_in();
}
);
Priority
↑ Back to topWhen multiple callbacks use the same hook, priority controls execution order. Higher numbers run later.
If another callback runs at priority 10 and yours needs to run after it, set the priority to 20 in your filter registration. Keep the accepted argument count aligned with your callback.
More Examples
↑ Back to topCustomize cart metadata label
The filter changes the label when Pre-Orders adds its availability row to cart item data. After adding a pre-order product, check that the label changes and the date is still visible. Replace the example text domain with your plugin’s text domain.
add_filter(
'wc_pre_orders_cart_item_meta',
function ( $meta ) {
if ( ! is_array( $meta ) || ! isset( $meta['name'] ) ) {
return $meta;
}
$meta['name'] = __( 'Pre-order release', 'your-text-domain' );
return $meta;
}
);
Run custom logic when pre-orders complete
This example writes a debug log entry when a pre-order completes. It uses the order argument and leaves the completion message alone. With debug logging enabled, complete a test pre-order and look for the pre-orders-example log source under WooCommerce > Status > Logs.
add_action(
'wc_pre_orders_pre_order_completed',
function ( $order ) {
wc_get_logger()->debug(
sprintf( 'Pre-order completed: #%d', $order->get_id() ),
array( 'source' => 'pre-orders-example' )
);
}
);
Troubleshooting
↑ Back to top- Hook not firing: confirm your code runs in the correct context (frontend/admin).
- No visual change: verify callback priority and accepted argument count.
- Date values not changing: confirm the product has a release timestamp.
- Gateway behavior not changing: confirm cart mode is pre-order and expected charge type is active.