FIXED IT
I was able to fix my function and it now works how intended. This is the working function and filter in case anyone wants to use. This will return custom text when flat rate shipping is free.
/* return custom text on email when shipping is free */
add_filter( 'woocommerce_order_shipping_to_display', 'filter_email_shipping_text', 10, 2 );
function filter_email_shipping_text( $shipping, $order_id ) {
global $woocommerce, $post;
$order = new WC_Order( $order_id );
if ( $order->order_shipping == 0 ) {
$shipping = sprintf(__( 'Free!', 'woocommerce' ));
}
return $shipping;
}
Related Posts:
- How to pass/get data to/from the WooCommerce data-product_variations object?
- Filter hook before create order WooCommerce
- Display WooCommerce newest product reviews on top [closed]
- How to change Woocommerce breadcrumbs content?
- Add Dropdown menu using “add_filter => wp_nav_menu_items”
- Filter category in WooCommerce shop page to display related sub-category
- How to change currency programmatically on creating order action?
- Redirect to checkout woocommerce failed
- Filter the regular price of woocommerce products
- Adaptive product filters for WooCommerce
- Add default user field to WooCommerce checkout [closed]
- Link to Shop-Filter with .current-menu-item
- Adding a Clone link to product attributes – post_row_actions() filter, or how to override a Class question
- Woocommerce “added to cart” message on main(home) page
- Replacing a deprecated filter ‘woocommerce_get_price’ with ‘woocommerce_product_get_price’
- Woocomemrce order and registration fileds to UPPERCASE
- Sorting products by price ( regular + sale price )
- Redirect to woocommerce checkout after adding to cart – item already in cart
- WooCommerce coupon hook argument NULL when using filter woocommerce_get_shop_coupon_data
- How to access page variable inside action hook
- Put data in my-account/view-order/id/ page
- WooCommerce comments_template Filter Not Firing
- Woocommerce: Only one review per verified buyer [closed]
- How to filter users on admin users page by custom meta field?
- How can I add an Author filter to the Media Library?
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- Hook into admin post list page
- Add post/page ID to inserted links within the_content
- How to exclude/filter a tag from get_the_tag_list()
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Ajax, filters and shortcodes
- Filter the blog’s title without using global variables
- Multiple Ajax Data Action
- Changing a WordPress core function without hacking core
- Change WordPress RSS link with filter?
- How to remove get_post_metadata using remove_filter inside a class?
- Rewriting Woocommerce Product Filters To URL Segments
- where to apply “apply filters” and other Sanitization Functions
- Add guid filter to attachment in media library grid mode
- Sorting and limitation with pre_get_posts
- Warning: Missing argument 2 for widget_title filter
- Change term name only on front
- How do I hide the current page’s title?
- Change name of existing post status type
- add_filter(‘the_content’, ‘…’) stops pagination from working
- Header image automatically changes depending on season
- How to remove SKU’s from ALL products in Quick View – already remove from each product page
- How to hide Ads in between posts on AMP? [closed]
- What is the downside of using a filter as a “poor man’s” dependency injection?
- BBPress changing default group activity
- How can I change the language of automated Mails?
- Filter the_content to add something before each element?
- How do you get specific tags from the_content?
- Add a filter inside an action init
- Filter by category and city for doctors and hospitals in wordpress
- Using add_filter to prepend content, result is out of order
- How to apply these filters
- Why is overwriting $GLOBALS killing the_content()?
- get_posts() interrupt because of filter
- Create new custom field that calculates age
- Remove comments validation (remove filter?)
- How to query if meta_key does exist or not?
- Disable sanitize_file_name on upload without modifying functions.php
- Remove Site Name from wp_title WITHOUT removing from attribute
- Plugin default settings hook
- add_filter to the_content after apply_filters
- Is there any reason for the nested filters to be applied on the first case and not in the second one?
- Best practice: Custom Post Type / Filter / Load more
- How to Edit Ecommerce filters URL, h1, h2 , Title
- Redirect an archive page to its relevant URL-friendly filtered page
- apply_filter and add_filter conflict
- Woocommerce – Hide shipping at all, if only certain product or products with certain shipping class is in the cart
- How to get the full product name by ignoring custom modification on it
- how to use substr with get_the_content()
- AJAX Post Filter
- Moving Quantity after product description
- Mystery line break
- How to add markup to the wp-custom-header div
- Display post after choice two taxonomy terms
- How to stop echoing gallery inside content?
- Having issue with dynamic data within restrict_manage_posts function
- how to filter datalist table of wordpress
- Ajax Filtering Pagination
- Custom permalink for attachment
- Is there a function to edit Blogs contents in Blogs page?
- Filter on the day of the week from timestamp
- using filters on the function from class
- Can’t set properly WordPress add_filter function
- Hook inside a hook
- Filter WordPress Archive Widget to exclude posts with specific custom taxonomy term id
- Password protected Page add_filter to change the text doesn’t work
- filter wptexturize doesn’t work on old posts titles
- remove_action conditionally for Custom Post Type – not working
- wp_get_attachment_link filter not working
- How would I remove an inline googleAPI font script in the the parent theme header.php?
- How to add custom checkout field in user details mail template
- Getting entry ID from frm_email_message filter in formidable
- Is there a hook or filter that adds a button to the left of the search box?
- Add custom ID to WooCommerce product tab