Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::get_data_store_instance()privateWC 1.0

Gets the instance of a given data store.

Method of the class: CustomOrdersTableController{}

No Hooks.

Return

\WC_Object_Data_Store_Interface|String. The actual data store to use.

Usage

// private - for code of main (parent) class only
$result = $this->get_data_store_instance( $default_data_store, $type );
$default_data_store(\WC_Object_Data_Store_Interface|string) (required)
The default data store (as received via the appropriate hooks).
$type(string) (required)
The type of the data store to get.

CustomOrdersTableController::get_data_store_instance() code WC 8.7.0

private function get_data_store_instance( $default_data_store, string $type ) {
	if ( $this->custom_orders_table_usage_is_enabled() ) {
		switch ( $type ) {
			case 'order_refund':
				return $this->refund_data_store;
			default:
				return $this->data_store;
		}
	} else {
		return $default_data_store;
	}
}