dqj96395 2019-06-21 15:27
浏览 34

基于重量的运输字符串名称版本

I am using weight based shipping rules on latest woocommerce version.

All is fine, except that i can't change the name of the string "Weight based Shipping" displayed in cart, order info, order emails.

I looked in PO files, templates, woo settings in admin tried to hook into :

get_shipping_to_display()

It does not work.

  /* translators: %s: method */

  if( $this->get_shipping_method() == 'Weight Based Shipping')
  {
    $shipping .= apply_filters( 'woocommerce_order_shipping_to_display_shipped_via', '&nbsp;<small class="shipped_via">' . 'via Colissimo' . '</small>', $this );
  } else {
    $shipping .= apply_filters( 'woocommerce_order_shipping_to_display_shipped_via', '&nbsp;<small class="shipped_via">' . sprintf( __( 'via %s', 'woocommerce' ), $this->get_shipping_method() ) . '</small>', $this );       
  }

EDIT

when overriding get_shipping_to_display()

directly in /woocommerce/includes/abstracts/abstract-wc-order.php

the emails show expected string for shipping.

So :

1- Is there a clean hook/filter to override that behaviour without editing core file ?

2 - Is that really the way to go for that real simple thing ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 软件测试决策法疑问求解答
    • ¥15 win11 23H2删除推荐的项目,支持注册表等
    • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
    • ¥15 qt6.6.3 基于百度云的语音识别 不会改
    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来