- This topic has 8 replies, 3 voices, and was last updated 5 years, 6 months ago by Tom.
-
AuthorPosts
-
October 22, 2018 at 8:12 pm #707723Brent Wilson
I want to change the text in WooCommerce cart and checkout, etc., from “Shipping” to “Shipping and Handling”. I have added the following php code, and it changed some instances. But in the cart table and the checkout table, it still says “Shipping” as the line title. Is this something coming from GeneratePress or WooCommerce? Any idea how I can get this issue fixed?
The site is https://outdoorgreetingcards.com.
// change shipping text
add_filter(‘gettext’, ‘translate_reply’);
add_filter(‘ngettext’, ‘translate_reply’);function translate_reply($translated) {
$translated = str_ireplace(‘Shipping’, ‘Shipping and Handling’, $translated);
return $translated;
}October 23, 2018 at 9:31 am #708321DavidStaffCustomer SupportHi there,
try this filter:
add_filter( 'woocommerce_shipping_package_name', 'custom_shipping_package_name' ); function custom_shipping_package_name( $name ) { return 'Your Text'; }
October 23, 2018 at 10:22 am #708368Brent WilsonWhere should I place this filter? In the same place as the other code? Do I keep the other php code that I have already placed? And is it the “Your Text” portion where I would put “Shipping and Handling”?
October 23, 2018 at 10:28 am #708388DavidStaffCustomer SupportSo remove the old code and add the new one with either method mentioned here:
https://docs.generatepress.com/article/adding-php/
And yes – Your Text gets changed to what you want in its place.
October 23, 2018 at 10:39 am #708397Brent WilsonSo now on the initial card page, it still says “Shipping” and the link to “Calculate Shipping” (see screenshot here:
But after calculating shipping or going to the checkout page, it now says “Shipping and Handling”.
I want the two instances in the screenshot above to also be changed from Shipping to Shipping and Handling. How can I do that? The previous code I had in changed the “Calculate Shipping” to “Calculate Shipping and Handling”
October 23, 2018 at 10:57 am #708418DavidStaffCustomer SupportSo what happens if you add back the code you had as well?
October 23, 2018 at 11:03 am #708426Brent WilsonNow that code I had does not seem to be changing the shipping calculation link.
October 23, 2018 at 11:19 am #708449DavidStaffCustomer SupportI am not sure what the solution is to cover both the Titles and the link, aside of setting up a child theme and editing those templates directly. All of the output is being created by Woo templates, so might be something you want to take up with them.
October 23, 2018 at 6:19 pm #708662TomLead DeveloperLead DeveloperThe code in your initial post is what I would have suggested. It looks like it should work.
Have you checked with WooCommerce support? They may have a better idea.
-
AuthorPosts
- You must be logged in to reply to this topic.