Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::get_data_store_instance()privateWC 1.0

Gets the instance of a given data store.

{} It's a 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.

Code of CustomOrdersTableController::get_data_store_instance() WC 7.1.0

private function get_data_store_instance( $default_data_store, string $type ) {
	if ( $this->is_feature_visible() && $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;
	}
}