How to change the text “Your order” on the checkout

放肆的年华 提交于 2021-02-08 12:13:51

问题


How to change the text "Your order" on the checkout in Woocommerce Checkout from the online shop


回答1:


There are a couple of ways. You can use gettext. As far as I can recall, the term you mentioned is translatable. If so, you can go ahead with the following function. Add this in your theme functions.php file (child theme recommended)

function custom_wc_translations($translated){
    $text = array(
    'Your order' => 'Your new phrase',
    'any other string' => 'New string',
    );
    $translated = str_ireplace(  array_keys($text),  $text,  $translated );
    return $translated;
}

add_filter( 'gettext', 'custom_wc_translations', 20 );

Alternatively, you can take help of jQuery. I am assuming that particular string is wrapped in an element with a class or ID

<script type="text/javascript">
(function($) {
$(document).ready(function() {
$('#your_my_order_element_id').html('Your New string');
//$('.your_my_order_element_class').html('Your New string');
});
})(jQuery);
</script>



回答2:


Check sting Your order in your WooCommerce or theme languagefile under wp-content/languages

If you are using WPML then you can find that string in WPML > String Translations.



来源:https://stackoverflow.com/questions/44216196/how-to-change-the-text-your-order-on-the-checkout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!