Support » Plugin: BLAZING WooCommerce Shipment Tracking » Change “You Can Track Your Order Here” text

  • Hi, how can I change the “You Can Track Your Order Here” text in emails?
    Because my website’s language is Chinese, I need to convert this text into Chinese version.
    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Massoud Shakeri

    (@massoudshakeri)

    You can customize the email template in Woocommerce->settings->emails->Order Shipment Tracking
    you can copy the template to your child theme, and add a few html lines before the generated tracking info.
    But make sure whenever woocommerce has a major update, in which they recommend to update the templates, you update the template copied in your theme as well.

    Hi, I’ve copy the template to my child theme. But I couldn’t find where is the generated tracking info.
    I edited bst-shipment-tracking.php as followed. But it doesn’t seem to work. Could you give me an example, please?
    `<?php
    /**
    * Customer note email
    *
    * This template can be overridden by copying it to yourtheme/woocommerce/emails/bst-shipment-tracking.php.
    *
    * HOWEVER, on occasion WooCommerce will need to update template files, so this
    * plugin will need to update the template. In that case please copy the new files
    * to your theme to maintain compatibility.
    *
    * @package blazing-wooCommerce-tracking/templates/emails
    * @category Template
    * @since 1.0
    */

    if ( ! defined( ‘ABSPATH’ ) ) {
    exit;
    }

    /**
    * @hooked WC_Emails::email_header() Output the email header
    */
    do_action( ‘woocommerce_email_header’, $email_heading, $email ); ?>

    <p><?php _e( “For your reference, your order details are shown below.”, ‘woocommerce’ ); ?></p>

    <?php

    function display_tracking_info($order_id, $for_email = false)
    {

    // print_r($this->bst_fields);
    $values = array();
    foreach ($this->bst_fields as $field) {
    $values[$field[‘id’]] = get_post_meta($order_id, ‘_’ . $field[‘id’], true);
    if ($field[‘type’] == ‘date’ && $values[$field[‘id’]]) {
    $values[$field[‘id’]] = date_i18n(__(‘l jS F Y’, ‘wc_shipment_tracking’), $values[$field[‘id’]]);
    }
    }
    $values[‘bst_tracking_provider’] = get_post_meta($order_id, ‘_bst_tracking_provider’, true);
    $values[‘bst_shipping_postcode’] = get_post_meta( $order_id, ‘_shipping_postcode’, true );
    if ( !isset($values[‘bst_shipping_postcode’]) || trim($values[‘bst_shipping_postcode’]) === ” ) {
    $values[‘bst_shipping_postcode’] = get_post_meta( $order_id, ‘_billing_postcode’, true );
    }
    $values[‘bst_shipping_country’] = get_post_meta( $order_id, ‘_shipping_country’, true );
    if ( !isset($values[‘bst_shipping_country’]) || trim($values[‘bst_shipping_country’]) === ” ) {
    $values[‘bst_shipping_country’] = get_post_meta( $order_id, ‘_billing_country’, true );
    }

    if (!$values[‘bst_tracking_provider’])
    return;

    if (!$values[‘bst_tracking_number’])
    return;

    $provider_url = ”;
    if ( array_key_exists(‘bst_tracking_provider’, $values) && $values[‘bst_tracking_provider’] != “” ) {
    foreach ($this->couriers as &$c) {
    if ( $c[‘slug’] == $values[‘bst_tracking_provider’] ) {
    if ( array_key_exists(‘url’, $c) ) {
    $provider_url = str_replace( “{tracking_number}”, $values[‘bst_tracking_number’], $c[‘url’]);
    $provider_url = str_replace( “{shipping_postcode}”, $values[‘bst_shipping_postcode’], $provider_url);
    $provider_url = str_replace( “{shipping_country}”, $values[‘bst_shipping_country’], $provider_url);
    break;
    }
    }
    }
    }
    $provider_url = str_replace(‘ ‘, ”, $provider_url);

    $options = get_option(‘bst_option_name’);
    if (array_key_exists(‘track_message_1’, $options) && array_key_exists(‘track_message_2’, $options)) {
    $track_message_1 = $options[‘track_message_1’];
    $track_message_2 = $options[‘track_message_2’];
    } else {
    $track_message_1 = ‘Your order was shipped via ‘;
    $track_message_2 = ‘Tracking number is ‘;
    }

    //$required_fields_values = array();

    echo $track_message_1 . $values[‘bst_tracking_provider_name’] . ‘<br/>’ . $track_message_2 . ” ” . “” . $values[‘bst_tracking_number’] . “” . “<br />”;

    if (/*!$for_email && */ $this->use_track_button && $provider_url != ” ) {
    $btn = “<span>追蹤包裹</span>“;
    echo $btn;
    // $this->display_track_button($values[‘bst_tracking_provider’], $values[‘bst_tracking_number’], $required_fields_values);
    }

    //————————————————————————————-
    /*
    $tracking_provider = get_post_meta($order_id, ‘_bst_tracking_provider’, true);
    $tracking_number = get_post_meta($order_id, ‘_bst_tracking_number’, true);
    $tracking_provider_name = get_post_meta($order_id, ‘_bst_tracking_provider_name’, true);
    $date_shipped = get_post_meta($order_id, ‘_bst_tracking_shipdate’, true);

    if (!$tracking_provider)
    return;

    if (!$tracking_number)
    return;

    $provider_name = $tracking_provider_name;
    $provider_required_fields = explode(“,”, $tracking_required_fields);

    $date_shipped_str = ”;
    $postcode_str = ”;
    $account_str = ”;

    foreach ($provider_required_fields as $field) {
    if ($field == ‘tracking_ship_date’) {
    if ($date_shipped) {
    $date_shipped_str = ‘ ‘ . sprintf(__(‘on %s’, ‘wc_shipment_tracking’), date_i18n(__(‘l jS F Y’, ‘wc_shipment_tracking’), $date_shipped));
    }
    } else if ($field == ‘tracking_postal_code’) {
    if ($postcode) {
    $postcode_str = ‘ ‘ . sprintf(‘The postal code is %s.’, $postcode);
    }
    } else if ($field == ‘tracking_account_number’) {
    if ($account) {
    $account_str = ‘ ‘ . sprintf(‘The account is %s.’, $account);
    }
    }
    }

    $provider_name = ‘ ‘ . __(‘via’, ‘wc_shipment_tracking’) . ‘ ‘ . $provider_name . ‘‘;

    echo wpautop(sprintf(__(‘Your order was shipped%s%s. Tracking number is %s.%s%s’, ‘wc_shipment_tracking’), $date_shipped_str, $provider_name, $tracking_number, $postcode_str, $account_str));

    if (!$for_email && $this->use_track_button) {
    $this->display_track_button($tracking_provider, $tracking_number);
    }
    */

    }
    /**
    * @hooked WC_Emails::order_details() Shows the order details table.
    * @hooked WC_Emails::order_schema_markup() Adds Schema.org markup.
    * @since 2.5.0
    */
    do_action( ‘woocommerce_email_order_details’, $order, $sent_to_admin, $plain_text, $email );

    /**
    * @hooked WC_Emails::order_meta() Shows order meta data.
    */
    do_action( ‘woocommerce_email_order_meta’, $order, $sent_to_admin, $plain_text, $email );

    /**
    * @hooked WC_Emails::customer_details() Shows customer details
    * @hooked WC_Emails::email_address() Shows email address
    */
    do_action( ‘woocommerce_email_customer_details’, $order, $sent_to_admin, $plain_text, $email );

    /**
    * @hooked WC_Emails::email_footer() Output the email footer
    */
    do_action( ‘woocommerce_email_footer’, $email );

    Hi, I’ve copy the template to my child theme. But I couldn’t find where is the generated tracking info.
    I edited bst-shipment-tracking.php but it doesn’t seem to work. Could you give me an example, please?

    Tobias_Conrad

    (@tobias_conrad)

    Please add the language string to the settings so we can change it.

    Tobias_Conrad

    (@tobias_conrad)

    i tried to translate plugin via loco translate, but i failed.
    please add stranslatable strings.

    also the sent tracking info button disapeares when enter tracking number.
    May add a default courier, also when onl one is avalable.

    thanks for the nice plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.