The Correct syntax for writing a add_filter
// Define the woocommerce_short_description callback
function filter_woocommerce_short_description( $post_excerpt ) {
// make filter magic happen here...
return $post_excerpt;
};
// add the filter
add_filter( 'woocommerce_short_description',filter_woocommerce_short_description',10, 1 );
Your code didn’t work well because the reason is that filter are used to modify the output.
Here is the function parameter you get the $post_excerpt
parameter which will be displayed if not filters modify it.
If you want to achieve your purpose you can return you desired string with the $post_excerpt
. You just need to modify the above code i mentioned with function like
function filter_woocommerce_short_description( $post_excerpt ) {
$your_msg='Order within <b>3 hours 27 minutes</b> to get it delivered for <b>only £1</b>';
return $post_excerpt.'<br>'.$your_msg;
}
Try this and lemme know if it works will for you.