SHARE
TWEET

Untitled

a guest May 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function wfacp_array_insert_after( array $array, $key, array $new ) {
  2.     $keys  = array_keys( $array );
  3.     $index = array_search( $key, $keys );
  4.     $pos   = false === $index ? count( $array ) : $index + 1;
  5.  
  6.     return array_merge( array_slice( $array, 0, $pos ), $new, array_slice( $array, $pos ) );
  7. }
  8.  
  9. // this code make company above the in billing address
  10. add_filter( 'wfacp_address_fields_billing', function ( $fields ) {
  11.     $company       = $fields['company'];
  12.     $company_field = [ 'company' => $company ];
  13.     unset( $fields['company'] );
  14.  
  15.     $fields = wfacp_array_insert_after( $fields, 'same_as_shipping', $company_field );
  16.  
  17.     return $fields;
  18. } );
  19.  
  20. // this code make company above the in shipping address
  21. add_filter( 'wfacp_address_fields_shipping', function ( $fields ) {
  22.     $company       = $fields['company'];
  23.     $company_field = [ 'company' => $company ];
  24.     unset( $fields['company'] );
  25.  
  26.     $fields = wfacp_array_insert_after( $fields, 'same_as_billing', $company_field );
  27.  
  28.     return $fields;
  29. } );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top