更改WooCommerce购物车和结帐页面中的'Shipping'文本:[复制新]



我正在使用WooCommerce与Babystreet主题,我试图改变单词"Shipping"在包含总数的篮子页面上。

我在这里找到了一些关于kriesi的建议。At和http://hookr.io/themes/evolve/3.7.2/actions/woocommerce_checkout_order_review/

但我不确定要添加的动作:钩子是"woocommerce_review_order"或";woocommerce_review_order_after_order_total"

我真的不确定,因为我的主题代码是:

<div id="order_review" class="woocommerce-checkout-review-order">
<table class="shop_table woocommerce-checkout-review-order-table">
<tr class="woocommerce-shipping-totals shipping">
<th>Expédition</th>

所以我在这两个之间犹豫:

add_filter( 'woocommerce_checkout_review_order', 'custom_checkout_review_order' );
function custom_checkout_review_order( $fields) {
return 'Expedition, après 25% de prise en charge';
} 

//Hook inAdd_filter ('woocommerce_checkout_review_order', 'custom_checkout_review_order');

//我们的钩入函数- $fields是通过过滤器传递的!函数custom_checkout_review_order($fields) {$fields['Expedition'] = 'Expedition, aprires 25% de price en charge';返回字段美元;}

谁能给点建议?

在您的活动主题函数。php文件中添加以下过滤器

这将改变购物车页面和结帐页面中的Shipping文本

add_filter( 'woocommerce_shipping_package_name', 'custom_shipping_package_name' );
function custom_shipping_package_name( $name ) {
return 'Delivery';
}

这将改变订单细节中的文本

add_filter('gettext','change_shipping_text');
add_filter('ngettext','change_shipping_text');
function change_shipping_text($text) {
$text = str_ireplace('Shipping','Delivery',$text);
return $text;
}

最新更新