Overwrite the product name in cart in WooCommerce

Overwrite the product name in cart in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

function custom_product_name_in_cart( $product_name, $cart_item, $cart_item_key ) {
    if ( $cart_item['product_id'] === YOUR_PRODUCT_ID ) {

        // Overwrite name
        $product_name = 'Custom Product Name';
    }
    return $product_name;
}
add_filter( 'woocommerce_cart_item_name', 'custom_product_name_in_cart', 10, 3 );

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.