Automattic\WooCommerce\Admin\Features\Blueprint\Exporters

ExportWCTaxRates::export()publicWC 1.0

Export WooCommerce tax rates.

Method of the class: ExportWCTaxRates{}

No Hooks.

Return

SetWCTaxRates.

Usage

$ExportWCTaxRates = new ExportWCTaxRates();
$ExportWCTaxRates->export();

ExportWCTaxRates::export() code WC 9.7.1

public function export() {
	global $wpdb;

	// Fetch tax rates from the database.
	$rates = $wpdb->get_results(
		"
            SELECT *
            FROM {$wpdb->prefix}woocommerce_tax_rates as tax_rates
            ",
		ARRAY_A
	);

	// Fetch tax rate locations from the database.
	$locations = $wpdb->get_results(
		"
            SELECT *
            FROM {$wpdb->prefix}woocommerce_tax_rate_locations as locations
            ",
		ARRAY_A
	);

	// Create a new SetWCTaxRates step with the fetched data.
	$step = new SetWCTaxRates( $rates, $locations );
	$step->set_meta_values(
		array(
			'plugin' => 'woocommerce',
		)
	);

	return $step;
}