Change title “Additional Information” in woocommerce

杀马特。学长 韩版系。学妹 提交于 2019-12-08 15:22:35

As it stands there is not hook to change the section title. But here's the hack if you are desperate enough to make the modification.

  1. Locate your template folder
  2. Create a folder named 'checkout'
  3. Locate the file form-shipping.php in the Woocommerce plugin foler under templates/checkout/
  4. Copy file in step 3 to the folder created in step 2
  5. Now you have superpowers over the checkout form

Edit this line:

<h3><?php _e( 'Additional Information', 'woocommerce' ); ?></h3>
function th_wc_order_review_strings( $translated_text, $text, $domain ) {

  if(is_checkout()){
    switch ($translated_text) {
      case 'Billing details' :
        $translated_text = __( 'Billing Info', 'woocommerce' );
        break;
      case 'Additional information':
        $translated_text = __('New Field Name', 'woocommerce');
        break;
     case 'Your order':
        $translated_text = __('My Order', 'woocommerce');
        break;
     case 'Product':
        $translated_text = __('Your Product', 'woocommerce');
        break;
    }
  }
  return $translated_text;
}
add_filter( 'gettext', 'th_wc_order_review_strings', 20, 3 );

This worked for me if anyone is still after this change

//Shipping Weight custom tab name

add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {

    $tabs['additional_information']['title'] = __( 'Additional Information' );  // Rename the Additional Information text
    return $tabs;

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!