I would like to remove 2 fields from the checkout page. The fields being 'address 2' and 'Telephone' is this possible and how do i go about this.
Thanks
I would like to remove 2 fields from the checkout page. The fields being 'address 2' and 'Telephone' is this possible and how do i go about this.
Thanks
Yes you can, use filters... see here-> http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-hooks-and-filters/
I followed the instructions per the given link and removed the billing_phone field from the checkout page. But when click the checkout button I am greeted with the following message:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'custom_override_checkout_fields' was given in /home/content/xxxxxxxxx/sitenamehere/wp-includes/plugin.php on line 170
Warning: Invalid argument supplied for foreach() in /home/content/xxxxxxxxx/sitenamehere/wp-content/plugins/woocommerce/classes/class-wc-checkout.php on line 157
This error does not show up with the phone field back in. What do the error messages mean? And how to fix it?
Here the test page with the buy button at the end of the page:
(Site in dutch, but you can safely ignore that)
Hard to help without seeing your code...try pasting it here..
Sorry about that:
/* WooCommerce: Remove phone number on checkout page. */
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
and
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_phone']);
return $fields;
}hmmm...Try this:
add_filter( 'woocommerce_checkout_fields', 'custom_override_checkout_fields', 10, 1 );
Copy and paste mine exactly.
Did as advised but still the same result.
Minor progress. Now the field is removed from the checkout page but when going for placing the order, the error message shows up that this is a required field even though it is not visible anymore.
You said "same result". Does that mean with my code, you're still getting the PHP error?
Royho,
My bad. This strange behaviour was a result of a missing } in one of the previously defined functions. So all is well again. Thank you for your support and patience.
How can I add multiple fields to remove, to that one bit of code?
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_phone']);
return $fields;
}
I also want to remove the entire address fields as my products are all free
You must log in to post.