How to change WooCommerce text shipping in checkout

前端 未结 4 1695
[愿得一人]
[愿得一人] 2020-12-10 08:15

I am trying to change a text in the WooCommerce checkout page from Shipping to Delivery from Your Order Section. I tried to open t

4条回答
  •  自闭症患者
    2020-12-10 08:48

    I used the solution by @Rahul S but I added the next code to change specific delivery text on cart and checkout.

    I added this code to the function.php on my theme. It work on cart page and checkout page

    You can replace ‘put-here-you-domain-i18n’ by you domain, by default it is ‘woocommerce’ by I recommend change it.

    The code to add is:

    add_filter( 'woocommerce_shipping_package_name' , 'woocommerce_replace_text_shipping_to_delivery', 10, 3);
    
    /**
     * 
     * Function to replace shipping text to delivery text
     * 
     * @param $package_name
     * @param $i
     * @param $package
     *
     * @return string
     */
    function woocommerce_replace_text_shipping_to_delivery($package_name, $i, $package){
        return sprintf( _nx( 'Delivery', 'Delivery %d', ( $i + 1 ), 'shipping packages', 'put-here-you-domain-i18n' ), ( $i + 1 ) );
    }
    

    I hope help you.

    You can see this.

提交回复
热议问题