Ever since we upgraded to Woocommerce version 3 our order confirmations are showing huge titles that include the variation detail. I don't like how it looks and it breaks some important functionalities in some custom-made plugins.
Reference: Order Name Showing Variations since update to WC version 3
There is a filter that can be used to disable this data displaying in the title called woocommerce_product_variation_title_include_attribute_name
from what I understand. But I have no idea where to apply the filter.
Is there a quick way to apply the filter to change it back to display as it did before?
Hide out of stock products To do this, take the following steps: From your WordPress dashboard, go to WooCommerce > Settings > Products > Inventory. Once here, check the Hide out of stock items from the catalog checkbox next to Out of stock visibility.
To hide or remove the page title in WooCommerce you have to add custom CSS or PHP code to your theme files to remove the title from your page. To do this, log into your WordPress site and in the left side menu go to Appearance > Customize and the find and click Additional CSS to insert the custom code found below.
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' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With