Automattic\WooCommerce\Admin\Features\Fulfillments

FulfillmentsTracker::determine_tracking_entry_method │ public static │ WC 10.7.0

Determine the tracking entry method from the request source and fulfillment meta data.

Maps the shipping option meta value to the standardized entry_method values expected by the fulfillment_tracking_added event. Whether the provider is custom or native is tracked separately via the is_custom_provider property on the event.

  • "ui_auto_lookup" : Tracking number was auto-detected via the lookup API.
  • "ui_manual" : Merchant manually selected or entered a provider.
  • "api" : Tracking was added via the REST API (not through the UI).

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

Хуков нет.

Возвращает

string. The entry method identifier.

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

$result = FulfillmentsTracker::determine_tracking_entry_method( $source, $shipping_option ): string;
$source(строка) (обязательный)
The request source ("fulfillments_modal" or "api").
$shipping_option(строка) (обязательный)
The shipping option meta value ("tracking-number", "manual-entry", or "no-info").

Список изменений

С версии 10.7.0 Введена.

Код FulfillmentsTracker::determine_tracking_entry_method() WC 11.2.2

public static function determine_tracking_entry_method( string $source, string $shipping_option ): string {
	if ( 'fulfillments_modal' !== $source ) {
		return 'api';
	}

	if ( 'tracking-number' === $shipping_option ) {
		return 'ui_auto_lookup';
	}

	if ( 'manual-entry' === $shipping_option ) {
		return 'ui_manual';
	}

	return 'api';
}