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:

functions.php
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.

  1. WooCommerce icon WooCommerce7+ million installs do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $values, $order ) includes/class-wc-checkout.php:626
  2. WooCommerce PayPal Payments icon 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
  3. Buckaroo Payments for WooCommerce icon 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
  4. Bus Ticket Booking with Seat Reservation icon 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
  5. FunnelKit Payment Gateway with PayPal for WooCommerce icon 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
  6. 우커머스 네이버페이 icon 우커머스 네이버페이200+ installs do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $values, $order ) includes/class-mnp-order.php:665
  7. Briqpay for WooCommerce icon Briqpay for WooCommerce10+ installs do_action( 'woocommerce_checkout_create_order_line_item', $item, $cart_item_key, $values, $order ) includes/class-checkout-handler.php:2002
  8. STRABL icon STRABL10+ installs do_action( 'woocommerce_checkout_create_order_line_item', $item, $cartItemKey, $values, $order ) src/Orders/Services/CartItemReplay.php:120
  9. Subscriptions & Recurring Payments for WooCommerce icon 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
  10. QuoteLane icon 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
  11. TogetherPay for WooCommerce icon 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.