wc_get_string_before_colon( string $string )

Get part of a string before :.


Description Description

Used for example in shipping methods ids where they take the format method_id:instance_id


Parameters Parameters

$string

(Required) String to extract.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-formatting-functions.php

function wc_get_string_before_colon( $string ) {
	return trim( current( explode( ':', (string) $string ) ) );
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.