skip to Main Content

Weird question but couldn’t find a way to overwrite any hook that is related to product description title. Is there a way to overwrite "Product description" and replace it with my own text? Thanks!

enter image description here

2

Answers


  1. Try the code given below:

    add_action( 'admin_enqueue_scripts', 'gs_admin_scripts', 20 );
    function gs_admin_scripts(){
        $screen = get_current_screen();
        $screen_id    = $screen ? $screen->id : '';
        if ( in_array( $screen_id, array( 'product' ), true ) ) {
            wp_localize_script(
                'wc-admin-product-editor',
                'woocommerce_admin_product_editor',
                array(
                    'i18n_description' => esc_js( __( 'My Custom Description Title is here', 'woocommerce' ) ),
                )
            );
        }
    }
    

    Add the code in the child theme`s functions.php or your plugin.

    The code has been tested and working.

    enter image description here

    Login or Signup to reply.
  2. You can easily do like this example below (Tested and worked)

    add_filter( 'gettext', 'your_prefix_change_product_description_title', 10, 2 );
    
    function your_prefix_change_product_description_title( $alt, $text )
    {
    global $pagenow, $typenow;
    if ('product' == $typenow ) {
    if ( 'Product description' == $text ) {
    return 'Your custom text';
    }
    }
    return $alt;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search