wc_get_relative_url()WC 3.2.0

Make a URL relative, if possible.

No Hooks.

Return

String.

Usage

wc_get_relative_url( $url );
$url(string) (required)
URL to make relative.

Changelog

Since 3.2.0 Introduced.

wc_get_relative_url() code WC 8.7.0

function wc_get_relative_url( $url ) {
	return wc_is_external_resource( $url ) ? $url : str_replace( array( 'http://', 'https://' ), '//', $url );
}