Add the parent product name to each cart item names in WooCommerce

Viewed 2349

I Would like to display the parent product name with child product name (cart item) in cart page, for my grouped products. I am selecting Parent product data as grouped product under linked product -> Grouped products adding child product.

The code from template cart.php:

echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key )

This is what I would like for each cart item:

Parent Product > Child Product

1 Answers
Related