Hide variation info from cart item title in WooCommerce 3+ Hide variation info from cart item title in WooCommerce 3+ wordpress wordpress

Hide variation info from cart item title in WooCommerce 3+


This filter should work returning a false value for $should_include_attributes first argument in woocommerce_product_variation_title_include_attributes filter hook this way:

add_filter( 'woocommerce_product_variation_title_include_attributes', 'custom_product_variation_title', 10, 2 );function custom_product_variation_title($should_include_attributes, $product){    $should_include_attributes = false;    return $should_include_attributes;}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

It should just work as you expect.


Update: The shorter way is:

add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

just works too.


A quick gotcha if you're using this filter to remove attributes from e-mail items. It appears that once an item has been written to an order the properties of it will not change.

add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );


As @freemason_17 pointed out, @LoicTheAztec's answer could potentially hide those details at other places as well so just to be sure I added a condition that would limit this to the cart page alone:

function custom_product_variation_title($should_include_attributes, $product){    if(is_cart()) {        $should_include_attributes = false;        return $should_include_attributes;    }}add_filter( 'woocommerce_product_variation_title_include_attributes', 'custom_product_variation_title', 10, 2 );