Automattic\WooCommerce\Admin\Features\Fulfillments\Providers

CustomShippingProvider::get_tracking_urlpublicWC 1.0

Get the tracking URL for a given tracking number.

Replaces __PLACEHOLDER__ in the template with the actual tracking number.

Method of the class: CustomShippingProvider{}

No Hooks.

Returns

String. The tracking URL with the placeholder replaced.

Usage

$CustomShippingProvider = new CustomShippingProvider();
$CustomShippingProvider->get_tracking_url( $tracking_number ): string;
$tracking_number(string) (required)
The tracking number.

CustomShippingProvider::get_tracking_url() code WC 10.9.4

public function get_tracking_url( string $tracking_number ): string {
	if ( empty( $this->tracking_url_template ) ) {
		return '';
	}

	return str_replace( '__PLACEHOLDER__', rawurlencode( $tracking_number ), $this->tracking_url_template );
}