0

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 ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.