I\'m trying to append text to WooCommerce product title in the cart if products has a specific tag.
This is what i have. I mis the conditional code.
function add_udstilling_below_cart_item_name( $item_name, $cart_item, $cart_item_key ) {
$product_id = $cart_item['product_id'];
/* Uncomment for debug purposes
$terms = wp_get_post_terms( $product_id, 'product_tag' );
echo '<pre>', print_r($terms, 1), '</pre>';
*/
if ( has_term( 'udstillingsmodel', 'product_tag', $product_id ) ) {
$item_name = $item_name . ' (test)';
}
return $item_name;
}
add_filter( 'woocommerce_cart_item_name', 'add_udstilling_below_cart_item_name', 10, 3 );