woocommerce_cart_item_backorder_notification │ filter-hook │ WC 3.4.0

Filter the backorder notification shown for a cart item.

Themes with an outdated copy of this template pass only the first two arguments, so callbacks that accept $cart_item and $cart_item_key should give them default values, e.g. $cart_item = null.

Usage

add_filter( 'woocommerce_cart_item_backorder_notification', 'wp_kama_woocommerce_cart_item_backorder_notification_filter', 10, 4 );

/**
 * Function for `woocommerce_cart_item_backorder_notification` filter-hook.
 * 
 * @param string $notification  The backorder notification HTML.
 * @param int    $product_id    The product ID. For a variation, this is the parent product ID.
 * @param array  $cart_item     The cart item data, including `variation_id` and the product in
 *                              `data`.
 * @param string $cart_item_key Unique key for the cart item.
 *
 * @return string
 */
function wp_kama_woocommerce_cart_item_backorder_notification_filter( $notification, $product_id, $cart_item, $cart_item_key ){
	// filter...
	return $notification;
}
$notification(string)
The backorder notification HTML.
$product_id(int)
The product ID. For a variation, this is the parent product ID.
$cart_item(array)
The cart item data, including variation_id and the product in data.
$cart_item_key(string)
Unique key for the cart item.

Changelog

Since 3.4.0 Introduced.
Since 11.3.0 Added the $cart_item and $cart_item_key parameters.

Where the hook is called

In file: /templates/cart/cart.php
woocommerce_cart_item_backorder_notification
woocommerce/templates/cart/cart.php 147
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>', $product_id, $cart_item, $cart_item_key ) );

Where the hook is used in WooCommerce

Usage not found.