Merge pull request #21856 from woocommerce/fix/21763

Apply field priority sorting on additional filters
This commit is contained in:
Claudiu Lodromanean 2018-11-08 10:08:14 -05:00 committed by GitHub
commit f39b006264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -704,7 +704,11 @@ class WC_Countries {
unset( $fields['address_2'] );
}
return apply_filters( 'woocommerce_default_address_fields', $fields );
$default_address_fields = apply_filters( 'woocommerce_default_address_fields', $fields );
// Sort each of the fields based on priority.
uasort( $default_address_fields, 'wc_checkout_fields_uasort_comparison' );
return $default_address_fields;
}
/**
@ -1280,6 +1284,10 @@ class WC_Countries {
* on country selection. If you want to change things like the required status of an
* address field, filter woocommerce_default_address_fields instead.
*/
return apply_filters( 'woocommerce_' . $type . 'fields', $address_fields, $country );
$address_fields = apply_filters( 'woocommerce_' . $type . 'fields', $address_fields, $country );
// Sort each of the fields based on priority.
uasort( $address_fields, 'wc_checkout_fields_uasort_comparison' );
return $address_fields;
}
}