自动发短信woocommerce_short_description hook

I am trying to create an automatic text in the description of the WooCommerce articles and put "article only available in the store."

I thought about putting it inside a function like this:

add_filter ('woocommerce_short_description', 'in_single_product', 10, 2);

function in_single_product () {
    echo '<p> my-text-here </ p>';
}

But the text does not appear in the front-end. It only appears if I put the text on the back-end.

Does anyone know why this happens?

The Correct syntax for writing add_filter

// Define the my_editor_content  
function my_editor_content( $post_excerpt )   {  
    // make filter magic happen here...
    return $post_excerpt;
};
// add the filter
add_filter( 'woocommerce_short_description','my_editor_content',10, 1 );

Well, you could use this code in functions.php of your child theme.

function my_editor_content( $post_excerpt ) {
$content = 'The default text, imposed by me, needs to be here in every product.';
return $content.'<br>'.$post_excerpt;
}

add_filter('woocommerce_short_description', 'my_editor_content', 10, 1);

I hope this will help you.

Use a conditional for single product pages and return the function variable instead of echoing it.

This will replace the post excerpt in single product pages:

add_filter( 'woocommerce_short_description', 'single_product_short_description', 10, 1 );
function single_product_short_description( $post_excerpt ){
    global $product;

    // compatibility with WC +3
    $product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id;

    if ( is_single( $product_id ) )
        $post_excerpt = '<p class="some-class">' . __( "my-text-here", "your_theme_slug" ) . '</ p>';

    return $post_excerpt;
}

Is better to ad your text in a gettex for translation (replace "your_theme_slug" by the slug of your theme...

Reference: How to use different short description in shop page and in product page in woocommerce