Last active
August 30, 2016 15:47
-
-
Save asharirfan/24d3feacbbef1588be0d1cc88986ff3a to your computer and use it in GitHub Desktop.
Function to override the checkout fields of WooCommerce.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function to override the checkout fields of WooCommerce. | |
* | |
*/ | |
if ( ! function_exists( 'override_woocommerce_checkout_fields' ) ) { | |
function override_woocommerce_checkout_fields( $fields ) { | |
unset( $fields[ 'billing' ][ 'billing_country' ] ); | |
unset( $fields[ 'billing' ][ 'billing_address_2' ] ); | |
unset( $fields[ 'billing' ][ 'billing_state' ] ); | |
unset( $fields[ 'billing' ][ 'billing_postcode' ] ); | |
unset( $fields[ 'order' ][ 'order_comments' ] ); | |
return $fields; | |
} | |
add_filter( 'woocommerce_checkout_fields' , 'override_woocommerce_checkout_fields' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/