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.
Related Posts:
- In WooCommerce I need to modify the thankyou.php page [closed]
- How can I add an extra WooCommerce hook
- Increment price for Woocommerce Minicart [closed]
- (Woocommerce) Order by price when entering specific category
- Copy and Modified WooCommerce function is_coupon_valid [closed]
- How to display custom field in woocommerce orders in admin panel?
- Issues with title-tag and document_title_parts
- How to create a custom order status in woocommerce!
- Import WordPress XML File from Within Functions.php
- Define custom Page Template without its own .php file
- Does hooking into the same action multiple times drain memory?
- How to show product SKU on product page
- How to influence the information displayed on widget inside wp-admin
- Extract image from content and set it as the featured image
- How to get woocommerce inventory status [closed]
- Is there a hook or function I can use to display all theme files being used on a current page?
- Woocommerce add to simple product attribute programmatically [closed]
- Issue with get_theme_mod returning a blank value instead of the saved value
- Add action hook conditionally – only when home.php in use
- Show modified time if post is actually modified
- why doesnt is_home() work in functions.php
- How to create thumbnails for PDF uploads?
- Implementing DNS Prefetching with WordPress
- Help me to understand wp_header() and wp_footer() functions
- Apply jquery script to only woocommerce product pages and categories
- How can I tell if I’m on a login page? [duplicate]
- Why get_header() or get_footer() does not run twice if called in the same php file?
- Remove Page Title from Static Frontpage
- How to override WordPress registration and insert an auto-generated username?
- Set default options for inserting media
- Change parent theme file function in child themes functions.php
- How to Acheive the custom woocommerce category template
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- How to hook into the quick edit action?
- gform_after_submission content appears immediately after , not in post body [closed]
- How do I change parameters without changing the core
- Remove product description from product archive page
- Is it possible to be more page/post specific with admin_enqueue_script?
- Hide some items from Screen options in dashboard for products
- display 100 products per page on product category page [closed]
- Adding WooCommerce to a Custom Theme – not working [closed]
- WooCommerce add_action hook results in 500 error
- Customize “the_posts_pagination” and put list instead div
- Exclude Empty Child Categories in Menu
- Can you use admin pages functionality on the frontend of your site
- Over write plugin templates
- change billing and shipping address 1 and 2 field placeholders [closed]
- Creating loop within functions.php
- Override woocommerce wc-class function
- Display WooCommerce subscriptions for user [closed]
- Change woocommerce products weight varation based its product category or tags? [closed]
- woocommerce target button with class after ajax update
- how to change link of some wordpress pages
- Gravity Forms field entries into wp_query loop [closed]
- Post thumbnail relative link and HTML modify
- Proper way of using functions in action hook?
- WordPress function for 1 to for many
- Pass parameters to function through an action
- How to preserve edits to Name or Slug of term when using wp_update_term on save?
- Woocommerce checkout field maxlength, make input number field only (postcode)
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- change in form-checkout.php by using code in functions.php
- How to properly add function called by action-hooked function to functions.php?
- Which action hook to use for function?
- Change size and crop medium_large images
- Set quantity of woocommerce product on page visit [closed]
- Gravity Forms – Using a Form to Pre-populate A Gravity Form [closed]
- Product Tags in Add New product as checkbox list [closed]
- Calling a function from anywhere, used in different places
- Running a script before absolutely everything
- Inserting a functions output after the content
- How to display post content instead of excerpt
- Add function to every post?
- Selective Product Category for Carousel
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Modify a function without editing template
- I want to get product attirbute in the section below
- Don’t delete a page if it holds users
- Problem only while using require_once() within functions.php
- Passing values from a widget to a function within a plugin
- Which action does wp_update_user triggers?
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- Load Woocommerce and WordPress Functions Outside
- How can I get my Script to work on the Login page?
- How to display custom option field in woocommerce orders in admin panel?
- Trigger a custom function when option are saved in admin area
- Execute a ultimate member action when user role is updated
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Add to cart php not working [closed]
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- How to auto refresh when user change postcode
- How to use wp_trash_post (or wp_delete_post) for deleting a (or all) post(s) from custom post type?
- When sale price is 0.00 show only regular price
- Remove the product category module block from the Woocommerce product page
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- how can I edit flexslider in woocommerce. [Urgent]
- Replace a menu with widget or a custom template file programmatically