WordPress action hook
woocommerce_checkout_create_order_fee_item
Defined by WooCommerce and fired by 6 plugins in total, running on 7.8M+ sites between them.
“Action hook to adjust item before save.”
How to use woocommerce_checkout_create_order_fee_item
It's an action: your callback runs at that point and receives 4 arguments. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'woocommerce_checkout_create_order_fee_item', function( $item, $fee_key, $fee, $order ) {
// Your code runs here.
}, 10, 4 );Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
6 plugins that fire woocommerce_checkout_create_order_fee_item
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
do_action( 'woocommerce_checkout_create_order_fee_item', $item, $fee_key, $fee, $order )includes/class-wc-checkout.php:663 -
WooCommerce PayPal Payments800,000+ installs
do_action( 'woocommerce_checkout_create_order_fee_item', $item, $fee_key, (object) $fee, $wc_order )modules/ppcp-order-endpoints/src/Helper/WooCommerceOrderCreator.php:234 -
Buckaroo Payments for WooCommerce2,000+ installs
do_action( 'woocommerce_checkout_create_order_fee_item', $feeItem, $fee_key, $fee, $order )src/Gateways/Applepay/ApplepayGateway.php:348 -
WebPOS40+ installs
do_action( 'woocommerce_checkout_create_order_fee_item', $item, $fee_key, $fee, $order )includes/frontend/orders.php:326 -
Briqpay for WooCommerce20+ installs
do_action( 'woocommerce_checkout_create_order_fee_item', $item, $fee->id, $fee, $order )includes/class-checkout-handler.php:2115 -
Subscriptions & Recurring Payments for WooCommerce10+ installs
do_action( 'woocommerce_checkout_create_order_fee_item', $fee_item, $fee_key, $fee, $subscription )inc/classes/class-awc-subscription-switchers.php:970
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.