WooCommerce Change Form Labels & Remove Fields

I'm trying to set up a WooCommerce checkout page, how can I edit the field labels?

Also, how can I remove 2 fields from the form? I don't need fields Company

and State

.

+3


source to share


2 answers


I recommend creating a custom plugin that changes this so you can easily update WooCommerce later.

In your custom plugin, implement the piece of code found here: http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-actions-and-filters/

For example, to delete a company and state:



// 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) {
    unset($fields['shipping']['shipping_state']);
    unset($fields['shipping']['shipping_company']);
    return $fields;
}

      

If you need help building a plugin, I've made a tutorial on adding custom fields to a product page. I think it might be helpful in this context. http://www.xatik.com/2013/02/06/add-custom-form-woocommerce-product/

+5


source


Here is a working hook you need to add to your theme. Functions.php file



add_filter( 'woocommerce_checkout_fields' , 'remove_checkout_fields' );

function remove_checkout_fields( $fields ) {
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_country']);
    return $fields;
}

      

+1


source







All Articles