• Resolved Abolfazl Edalati

    (@drowranger)


    Hello

    I won’t hide some parts of my Product Name

    For Example, Product Name is: bitcoin_user_SN_1662265923

    Now I want the show to be on my site like this: bitcoin_user

    I don’t want to delete _SN_1662265923 but I want don’t show it to my customer

Viewing 1 replies (of 1 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi there,

    Thanks for reaching out!

    I understand you want to keep the product title on the product admin page but display only a part of it in the frontend shop and single product page.

    This is out of scope on this forum but you could try the following snippet that I had saved on one of my test sites and was ready to use:

    
    add_filter( 'the_title', 'change_product_title', 10, 2 );
    function change_product_title( $title, $id ) {
        $Find = 'bitcoin_user_SN_1662265923';
        $ReplaceWith = 'bitcoin_user';
        //REMOVE DESIRED STRING FROM PRODUCT TITLE
        $title = str_replace($Find, $ReplaceWith, $title);
        return $title;
    }
    

    Add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code Snippets plugin.

    If you need further help with customizations or if the above snippet doesn’t work for you please consider hiring a web developer or a customization expert – https://woocommerce.com/customizations/.

    Cheers.

Viewing 1 replies (of 1 total)
  • The topic ‘Filter Product Name’ is closed to new replies.