WooCommerce - Modify shipping message

Discussion in 'HTML & Website Design' started by dabidovic123, Jun 15, 2023.

  1. #1
    protected function render_shipping_address_column() {
         $address = $this->object->get_formatted_shipping_address();
    
         if ( $address ) {
           echo '<a target="_blank" href="' . esc_url( $this->object->get_shipping_address_map_url() ) . '">' . esc_html( preg_replace( '#<br\s*/?>#i', ', ', $address ) ) . '</a>';
           if ( $this->object->get_shipping_method() ) {
             /* translators: %s: shipping method */
             echo '<span class="description">' . sprintf( __( 'via %s', 'woocommerce' ), esc_html( $this->object->get_shipping_method() ) ) . '</span>'; // WPCS: XSS ok.
           }
         } else {
           echo '&ndash;';
         }
       }
    PHP:

    This code can be found in the WooCommerce "class-wc-admin-list-table-orders.php" file at :
    wp-content/plugins/woocommerce/includes 2/admin/list-tables/class-wc-admin-list-table-orders.php

    This code displays the following message: "via shipping-method".

    I would like to remove the word "via" from this massage, as I had made a change that makes the message display the "weight" instead of "shipping-method".

    This makes "via Weight" meaningless, that's why I'd like to remove it.

    I don't want to remove it manually. I would be grateful if you could provide me with a snippet code to place in the functions.php file in the child theme to remove it.

    Thanks in advance,
     
    dabidovic123, Jun 15, 2023 IP
  2. dabidovic123

    dabidovic123 Greenhorn

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    I would like to clarify that I would like to remove the word "via" from the messages that appear on the "thank you" page, the emails that the customer receives and on the invoice.

    I provide here a screeshot of an example: https://www.screencast.com/t/MUhysN7c

    Thank you very much,
     
    dabidovic123, Jun 16, 2023 IP