WordPress action hook
woocommerce_checkout_create_order_line_item
Defined by WooCommerce and fired by 11 plugins in total, running on 7.7M+ sites between them.
“Action hook to adjust item before save.”
How to use woocommerce_checkout_create_order_line_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_line_item', function( $item, $cart_item_key, $values, $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.
11 plugins that fire woocommerce_checkout_create_order_line_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_line_item', $item, $cart_item_key, $values, $order )includes/class-wc-checkout.php:626 -
WooCommerce PayPal Payments700,000+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $cart_item, $wc_order )modules/ppcp-order-endpoints/src/Helper/WooCommerceOrderCreator.php:200 -
Buckaroo Payments for WooCommerce2,000+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $orderItem, $cart_item_key, $cart_item, $order )src/Gateways/Applepay/ApplepayGateway.php:320 -
Bus Ticket Booking with Seat Reservation600+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, 'wbtm_app', $values, $order )inc/WBTM_App_Booking.php:255 -
FunnelKit Payment Gateway with PayPal for WooCommerce200+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $cart_item, $order )includes/Payments/Gateways/AbstractGateway.php:436 -
우커머스 네이버페이200+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $values, $order )includes/class-mnp-order.php:665 -
Briqpay for WooCommerce10+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $values, $order )includes/class-checkout-handler.php:2002 -
STRABL10+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, $cartItemKey, $values, $order )src/Orders/Services/CartItemReplay.php:120 -
Subscriptions & Recurring Payments for WooCommerce10+ installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $cart_item, $subscription )inc/classes/class-awc-subscription-switchers.php:872 -
QuoteLaneFewer than 10 installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, (string) ( $line['key'] ?? 'qlane' ), $line, $order )includes/class-line-options.php:124 -
TogetherPay for WooCommerceFewer than 10 installs
do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_items_key, $values, $order )class/WC_Gateway_SplitOff.php:2449
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.