Add $tax_rate_id to the added and updated actions
Resolves https://github.com/woothemes/woocommerce/issues/5524
This commit is contained in:
parent
b96d1f5e61
commit
e310146ec4
|
@ -567,12 +567,12 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
|||
'tax_rate_class' => sanitize_title( $current_class )
|
||||
);
|
||||
|
||||
do_action( 'woocommerce_tax_rate_added', $tax_rate );
|
||||
|
||||
$wpdb->insert( $wpdb->prefix . "woocommerce_tax_rates", $tax_rate );
|
||||
|
||||
$tax_rate_id = $wpdb->insert_id;
|
||||
|
||||
do_action( 'woocommerce_tax_rate_added', $tax_rate_id, $tax_rate );
|
||||
|
||||
if ( ! empty( $postcode ) ) {
|
||||
$postcodes = explode( ';', $postcode );
|
||||
$postcodes = array_map( 'strtoupper', array_map( 'wc_clean', $postcodes ) );
|
||||
|
@ -664,8 +664,6 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
|||
'tax_rate_class' => sanitize_title( $current_class )
|
||||
);
|
||||
|
||||
do_action( 'woocommerce_tax_rate_updated', $tax_rate );
|
||||
|
||||
$wpdb->update(
|
||||
$wpdb->prefix . "woocommerce_tax_rates",
|
||||
$tax_rate,
|
||||
|
@ -674,6 +672,8 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
|||
)
|
||||
);
|
||||
|
||||
do_action( 'woocommerce_tax_rate_updated', $tax_rate_id, $tax_rate );
|
||||
|
||||
if ( isset( $tax_rate_postcode[ $key ] ) ) {
|
||||
// Delete old
|
||||
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations WHERE tax_rate_id = %d AND location_type = 'postcode';", $tax_rate_id ) );
|
||||
|
|
Loading…
Reference in New Issue