Fixed WooCommerce 3.9 support

This commit is contained in:
Claudio Sanches 2019-12-05 21:58:57 -03:00
parent 0b1c1dd422
commit 613502e57d
2 changed files with 11 additions and 2 deletions

View File

@ -516,7 +516,12 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
case 'delete_taxes':
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rates;" );
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rate_locations;" );
WC_Cache_Helper::incr_cache_prefix( 'taxes' );
if ( method_exists( 'WC_Cache_Helper', 'invalidate_cache_group' ) ) {
WC_Cache_Helper::invalidate_cache_group( 'taxes' );
} else {
WC_Cache_Helper::incr_cache_prefix( 'taxes' );
}
$message = __( 'Tax rates successfully deleted', 'woocommerce-rest-api' );
break;

View File

@ -179,7 +179,11 @@ class ProductHelper {
// Make sure caches are clean.
\delete_transient( 'wc_attribute_taxonomies' );
WC_Cache_Helper::incr_cache_prefix( 'woocommerce-attributes' );
if ( method_exists( '\WC_Cache_Helper', 'invalidate_cache_group' ) ) {
\WC_Cache_Helper::invalidate_cache_group( 'woocommerce-attributes' );
} else {
\WC_Cache_Helper::incr_cache_prefix( 'woocommerce-attributes' );
}
// These are exported as labels, so convert the label to a name if possible first.
$attribute_labels = \wp_list_pluck( wc_get_attribute_taxonomies(), 'attribute_label', 'attribute_name' );