WC_Structured_Data::prepare_gtin()
Prepare a GTIN input removing everything except numbers.
Method of the class: WC_Structured_Data{}
No Hooks.
Returns
String
. Empty string if no GTIN is provided or the string with the replacements.
Usage
$WC_Structured_Data = new WC_Structured_Data(); $WC_Structured_Data->prepare_gtin( $gtin );
- $gtin(string) (required)
- The GTIN to prepare.
WC_Structured_Data::prepare_gtin() WC Structured Data::prepare gtin code WC 9.8.5
public function prepare_gtin( $gtin ) { if ( ! $gtin || ! is_string( $gtin ) ) { return ''; } return preg_replace( '/[^0-9]/', '', $gtin ); }