Hi every one let me try to explain this.
PLEASE NOTE: i use the woo commerce block plugin (for the cart and checkout pages to replace the original shortcode)
i want to change my instances where the word shipping is to change to the word Delivery
i use this hook in my functions.php and it did change the one word to delivery so that worked
add_filter('woocommerce_shipping_package_name', 'change_shipping_text_to_delivery', 20, 3 );
function change_shipping_text_to_delivery( $sprintf, $i, $package ) {
$sprintf = sprintf( _nx( 'Delivery', 'Delivery %d', ( $i + 1 ), 'delivery packages', 'woocommerce' ), ( $i + 1 ) );
return $sprintf;
}
as you can see on the cart page it only changed the one word not the other two
okay then when i go to my PROCEED TO CHECKOUT AND GO TO THE PAGE
THIS IS MY CHECKOUT PAGE(also UNCHAGED)
i have insert this in my php functions did not work
/*
* Change the string "Shipping" to "Delivery" on Order Received page.
*/
add_filter('gettext', 'translate_reply');
add_filter('ngettext', 'translate_reply');
function translate_reply($translated) {
$translated = str_ireplace('Shipping', 'Delivery', $translated);
return $translated;
}
i also tried going to my plugin folder
i did get some code in there where i replaced the strings shipping to delviery and it did not do anything !
return (
<FormStep
id="shipping-fields"
disabled={ checkoutIsProcessing }
className="wc-block-checkout__shipping-fields"
title={ __( 'Shipping address', 'woo-gutenberg-products-block' ) }
description={ __(
'Enter the physical address where you want us to deliver your order.',
'woo-gutenberg-products-block'
) }
>
{ children }
<CheckboxControl
className="wc-block-checkout__use-address-for-billing"
label={ __(
'Use same address for billing',
'woo-gutenberg-products-block'
) }
checked={ shippingAsBilling }
onChange={ ( isChecked ) => setShippingAsBilling( isChecked ) }
/>
</FormStep>
Please can someone help me i just want to change those words to DELIVERY
2
Answers
i did come right with this code but i had to remove the woo commerce gutenberg block i reverted back to the default woo commerce shortcodes
Try something like below. This uses a filter hook to change the values in the $fields array. In your case, you are changing order details
This would go in your functions.php file.