In a recent version of WooCommerce the developers made a tweak to how variable products are show when they only have one attribute. The chose attribute value is shown directly in the product title when, in example, the product is added to the cart.
I’ve noticed that not everyone likes this new feature and some asked to revert it back to how it was before.
Can we accommodate everyone? Yes, here is how.
Let’s Write Some Code!
I created a Pull Request not too long ago to add the filter
woocommerce_is_attribute_in_product_name to the core of WooCommerce.
This filter can be used to show the attributes below the product title, like it was before the most recent version of WooCommerce.
You can add this code to the functions.php file in wp-content/themes/your-child-theme-name/ to do that:
This code alone though is not enough. You will now see the attributes table below the product title, but also you will see the attribute in the product title.
To remove it from there, you need some more code:
Using both these snippets together will make sure that you only show the attributes table like it was before, and the title of the product will be the one that you set in the Dashboard, with nothing added to it.