Merge pull request #2431 from thenbrent/deprecated-find-rate-args
Deprecate old params for WC_Tax->find_rates()
This commit is contained in:
commit
3a734e230e
|
@ -29,9 +29,35 @@ class WC_Tax {
|
||||||
* @param string $args (default: '')
|
* @param string $args (default: '')
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function find_rates( $args = '' ) {
|
public function find_rates( $args = array(), $deprecated_state = null, $deprecated_postcode = null, $deprecated_class = null ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
// Make sure the arguments match the WC 2.0 structure
|
||||||
|
if ( is_string( $args ) ) {
|
||||||
|
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["country"] instead.', 'woocommerce' ) );
|
||||||
|
$args = array(
|
||||||
|
'country' => $args
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( func_num_args() > 1 ) {
|
||||||
|
|
||||||
|
if ( null !== $deprecated_state ) {
|
||||||
|
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["state"] instead.', 'woocommerce' ) );
|
||||||
|
$args['state'] = $deprecated_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( null !== $deprecated_postcode ) {
|
||||||
|
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["postcode"] instead.', 'woocommerce' ) );
|
||||||
|
$args['postcode'] = $deprecated_postcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( null !== $deprecated_class ) {
|
||||||
|
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["tax_class"] instead.', 'woocommerce' ) );
|
||||||
|
$args['tax_class'] = $deprecated_class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'country' => '',
|
'country' => '',
|
||||||
'state' => '',
|
'state' => '',
|
||||||
|
|
Loading…
Reference in New Issue