WC_Tax::_update_tax_rate_locations PHP Method

_update_tax_rate_locations() private static method

Internal use only.
Since: 2.3.0
private static _update_tax_rate_locations ( integer $tax_rate_id, $values, string $type ) : string
$tax_rate_id integer
$type string
return string
    private static function _update_tax_rate_locations($tax_rate_id, $values, $type)
    {
        global $wpdb;
        $tax_rate_id = absint($tax_rate_id);
        $wpdb->query($wpdb->prepare("\n\t\t\t\tDELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations WHERE tax_rate_id = %d AND location_type = %s;\n\t\t\t\t", $tax_rate_id, $type));
        if (sizeof($values) > 0) {
            $sql = "( '" . implode("', {$tax_rate_id}, '" . esc_sql($type) . "' ),( '", array_map('esc_sql', $values)) . "', {$tax_rate_id}, '" . esc_sql($type) . "' )";
            $wpdb->query("\n\t\t\t\tINSERT INTO {$wpdb->prefix}woocommerce_tax_rate_locations ( location_code, tax_rate_id, location_type ) VALUES {$sql};\n\t\t\t\t");
        }
        WC_Cache_Helper::incr_cache_prefix('taxes');
    }