Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::create_custom_orders_tables()privateWC 1.0

Create the custom orders tables in response to the user pressing the tool button.

Method of the class: CustomOrdersTableController{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->create_custom_orders_tables();

CustomOrdersTableController::create_custom_orders_tables() code WC 7.1.0

private function create_custom_orders_tables() {
	// phpcs:ignore WordPress.Security.ValidatedSanitizedInput
	if ( ! isset( $_REQUEST['_wpnonce'] ) || wp_verify_nonce( $_REQUEST['_wpnonce'], 'debug_action' ) === false ) {
		throw new \Exception( 'Invalid nonce' );
	}

	if ( ! $this->is_feature_visible() ) {
		throw new \Exception( "Can't create the custom orders tables: the feature isn't enabled" );
	}

	$this->data_synchronizer->create_database_tables();
	update_option( self::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION, 'no' );
}