Change title “Additional Information” in woocommer

2019-05-30 15:57发布

I want to change the title from the checkout page. But I just can change the label and the placeholder.

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
     $fields['order']['order_comments']['placeholder'] = 'Please type your PO number here and we will add it to the invoice.';
     $fields['order']['order_comments']['label'] = '';
     return $fields;
}

2条回答
Anthone
2楼-- · 2019-05-30 16:12

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>
查看更多
再贱就再见
3楼-- · 2019-05-30 16:20

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;

}
查看更多
登录 后发表回答