Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wfacp_array_insert_after( array $array, $key, array $new ) {
- $keys = array_keys( $array );
- $index = array_search( $key, $keys );
- $pos = false === $index ? count( $array ) : $index + 1;
- return array_merge( array_slice( $array, 0, $pos ), $new, array_slice( $array, $pos ) );
- }
- // this code make company above the in billing address
- add_filter( 'wfacp_address_fields_billing', function ( $fields ) {
- $company = $fields['company'];
- $company_field = [ 'company' => $company ];
- unset( $fields['company'] );
- $fields = wfacp_array_insert_after( $fields, 'same_as_shipping', $company_field );
- return $fields;
- } );
- // this code make company above the in shipping address
- add_filter( 'wfacp_address_fields_shipping', function ( $fields ) {
- $company = $fields['company'];
- $company_field = [ 'company' => $company ];
- unset( $fields['company'] );
- $fields = wfacp_array_insert_after( $fields, 'same_as_billing', $company_field );
- return $fields;
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement