Created
December 2, 2018 12:48
-
-
Save mijankarim/d2a8862052c027c28d6ef020126922b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_cart_item_name', 'custom_variation_item_name', 10, 3 ); | |
function custom_variation_item_name( $item_name, $cart_item, $cart_item_key ){ | |
// Change item name only if is a product variation | |
if( $cart_item['data']->is_type('variation') ){ | |
// HERE customize item name | |
$item = $cart_item['data']; | |
$item_name = $item->get_name(); | |
// For cart page we add back the product link | |
if(is_cart()) | |
$item_name = sprintf( '<a href="%s">%s</a>', esc_url( $cart_item['data']->get_permalink() ), $item_name ); | |
} | |
return $item_name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment