How to remove the parent name from the child name with grouped products in Woocommmerce?

A group product is a collection of simple products that can be purchased individually only. By default when we add an item of group product to cart, it will display parent product before that as well on cart and checkout page e.g. Parent Product Name → Child Product Name.

In this tutorial we’ll learn how to remove parent product name when a child of group product is added to cart and checkout page.

First of all create a group product that will serve as a parent product. I’ve entered a self explanatory name for this i.e. Parent Product.

Now assign some child products to it by creating and assigning simple products.

woocommerce

After assigning some child products to parent go to parent product from front end and add one of child product to cart.

woocommerce

On proceeding to cart and checkout page you’ll see parent product title attached before child product title.

Product on cart will be like:

woocommerce

And on checkout page will be:

woocommerce

Now we need to remove parent product title.

To do this add the following lines of code at the end of your theme’s functions.php file:

function gfl_product_title($title, $product) {

   return $product->post->post_title;;

}

add_filter('woocommerce_product_title', 'gfl_product_title', 10, 2);

Place the code in functions.php and save the file.

After that again go to cart and checkout pages and parent product title will be removed.

Cart page will look like:
woocommerce

And the checkout page will be:

woocommerce

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

1 thought on “How to remove the parent name from the child name with grouped products in Woocommmerce?”

Leave a Comment

Your email address will not be published. Required fields are marked *