Automattic\WooCommerce\Admin\Features\Fulfillments

FulfillmentsController::register_data_storespublicWC 1.0

Register the fulfillments data store via the woocommerce_data_stores filter.

This allows extensions to replace the data store with a custom implementation by filtering woocommerce_data_stores 'woocommerce_order-fulfillment_data_store'.

Method of the class: FulfillmentsController{}

No Hooks.

Returns

array.

Usage

$FulfillmentsController = new FulfillmentsController();
$FulfillmentsController->register_data_stores( $data_stores );
$data_stores(array) (required)
Data stores.

FulfillmentsController::register_data_stores() code WC 11.0.1

public function register_data_stores( $data_stores ) {
	if ( ! is_array( $data_stores ) ) {
		return $data_stores;
	}

	// Check the option directly instead of using FeaturesController::feature_is_enabled()
	// because the woocommerce_data_stores filter can fire before the 'init' action
	// (e.g. from WC Payments during 'plugins_loaded'), and feature_is_enabled() would
	// trigger translation loading too early, causing _load_textdomain_just_in_time warnings.
	if ( 'yes' !== get_option( 'woocommerce_feature_fulfillments_enabled', 'no' ) ) {
		return $data_stores;
	}

	$data_stores['order-fulfillment'] = FulfillmentsDataStore::class;
	return $data_stores;
}