Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::add_initiate_regeneration_entry_to_tools_array()publicWC 1.0

Gets the instance of the refunds data store to use.

Метод класса: CustomOrdersTableController{}

Хуков нет.

Возвращает

\WC_Object_Data_Store_Interface|Строку. The actual data store to use.

Использование

$CustomOrdersTableController = new CustomOrdersTableController();
$CustomOrdersTableController->return $this->get_data_store_instance( $default_data_store, foo );
$default_data_store(\WC_Object_Data_Store_Interface|строка) (обязательный)
The default data store (as received via the woocommerce_order-refund_data_store hook).
foo (обязательный)
-

Код CustomOrdersTableController::add_initiate_regeneration_entry_to_tools_array() WC 9.3.3

return $this->get_data_store_instance( $default_data_store, 'order_refund' );
	}

	/**
	 * Gets the instance of a given data store.
	 *
	 * @param \WC_Object_Data_Store_Interface|string $default_data_store The default data store (as received via the appropriate hooks).
	 * @param string                                 $type               The type of the data store to get.
	 *
	 * @return \WC_Object_Data_Store_Interface|string The actual data store to use.
	 */
	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;
}
	}

	/**
	 * Add an entry to Status - Tools to create or regenerate the custom orders table,
	 * and also an entry to delete the table as appropriate.
	 *
	 * @param array $tools_array The array of tools to add the tool to.
	 * @return array The updated array of tools-
	 */
	private function add_hpos_tools( array $tools_array ): array {