mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
9 lines
332 B
Text
9 lines
332 B
Text
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 );
|