Back to list of all filter and action hooks for Fluid Checkout PRO.
Description #
This action hook fires before the cart item total price is displayed for each cart item.
Parameters #
$cart_item(array) The cart item data array.$cart_item_key(string) The unique key for this cart item.$_product(WC_Product) The product object.
Example #
/**
* Add discount badge before item total
*/
function add_discount_badge_before_total( $cart_item, $cart_item_key, $_product ) {
// Check if item is on sale
if ( $_product->is_on_sale() ) {
echo '<div class="cart-item-sale-badge">';
echo '<span class="badge">On Sale!</span>';
echo '</div>';
}
}
add_action( 'fc_pro_cart_item_totals_before', 'add_discount_badge_before_total', 10, 3 );
