I'm looking to hook into the woocommerce_cart_item_name
filter in WooCommerce and would like to display the product ID after the name ONLY for a specific Product.
I'm looking at this code:
add_filter( 'woocommerce_cart_item_name', 'just_a_test', 10, 3 );
function just_a_test( $item_name, $cart_item, $cart_item_key ) {
// Display name and product id here instead
echo $item_name.' ('.$cart_item['product_id'].')';
}
This indeed returns the name with a product ID but it applies on all Products on my store.
Only want to display the product ID for a specified product. I'm curious how I'd go about doing this?