Automattic\WooCommerce\Admin\Features\Fulfillments

FulfillmentsTracker::track_fulfillment_updatepublic staticWC 10.7.0

Track when an existing fulfillment is successfully updated.

Tracked from: OrderFulfillmentsRestController::update_fulfillment(). Measures: How often merchants modify fulfillments and which fields change most.

Method of the class: FulfillmentsTracker{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = FulfillmentsTracker::track_fulfillment_update( $source, $fulfillment_id, $original_status, $changed_fields, $notification_sent ): void;
$source(string) (required)
The source of the update ("fulfillments_modal" or "api").
$fulfillment_id(int) (required)
The ID of the fulfillment being updated.
$original_status(string) (required)
The status before the update ("draft" or "fulfilled").
$changed_fields(array) (required)
The changes as returned by Fulfillment::get_changes(). Core data props (e.g. 'status') at top level, meta changes under 'meta_data'. Serialized as JSON by WC_Tracks.
$notification_sent(true|false) (required)
Whether a customer re-notification was requested.

Changelog

Since 10.7.0 Introduced.

FulfillmentsTracker::track_fulfillment_update() code WC 10.7.0

public static function track_fulfillment_update( string $source, int $fulfillment_id, string $original_status, array $changed_fields, bool $notification_sent ): void {
	WC_Tracks::record_event(
		'fulfillment_updated',
		array(
			'source'            => $source,
			'fulfillment_id'    => $fulfillment_id,
			'original_status'   => $original_status,
			'changed_fields'    => $changed_fields,
			'notification_sent' => $notification_sent,
		)
	);
}