In my custom order WooCommerce email templates to clients, I am inserting a custom list of shipping and billing data. The first list column with the label and the second with the respective data.
For the moment, I have inserted manually the label names, equal to those in woocommerce checkout, and then I have inserted by code the respective values/data. This implies that I have to translate all these labels to all the languages that I need, when I have already done that with the native Woocommerce checkout labels.
Also, as this is done twice, it can be the case that the translations are not exactly equal. This is not efficient and also increases code.
In order to avoid this, I would like to substitute the labels by the corresponding woocommerce checkout field labels.
Below my current code, where each string '$text_xx' represent a label that I have manually defined before:
# (...)
$text_42b = __('First name:', 'woocommerce_php_emails');
# (...)
echo '<p id="Linha1">' . $line . '</p><p id="Shipping_title_completed">' . $text_41 . '</p>
<div class="Shipping_table_completed">
<div class="left_table" style="float: left; width: 25%;"><ul>
<li>' . $text_42a . '</li>
<li>' . $text_42b . '</li>
<li>' . $text_42c . '</li>
<li>' . $text_42d . '</li>
<li>' . $text_42e . '</li>
<li>' . $text_42f . '</li>
<li> </li>
<li>' . $text_42g . '</li>
<li>' . $text_42h . '</li>
<li>' . $text_42i . '</li>
<li>' . $text_42j . ':</li>
</ul></div>
<div class="right_table" style="float: left; width: 75%;"><ul>
<li>' . $shipping_title . ' </li>
<li>' . $order->get_shipping_first_name() . ' </li>
<li>' . $order->get_shipping_last_name() . ' </li>
<li>'. $order->get_shipping_company() . ' </li>
<li>' . $tracking_num_s . ' </li>
<li>' . $order->get_shipping_address_1() . ' </li>
<li>' . $order->get_shipping_address_2() . ' </li>
<li>' . $order->get_shipping_postcode() . ' </li>
<li>' . $order->get_shipping_city() . ' </li>
<li>' . $order->get_shipping_state() . ' </li>
<li>' . $order->get_shipping_country() . ' </li>
</ul></div>
<div class="Shipping_table_completed1"><img src="https://testing987654321hello.com/wp-content/uploads/2017/12/delivery-service.jpg" alt=""></div>
</div><p id="Linha2">' . $line . '</p><div class="Last_text_completed"><p>' . $text_61 . '<br><br><br>' . $text_60 . '</p></div>';