WC_Product::get_formatted_name
Get product name with SKU or ID. Used within admin.
Method of the class: WC_Product{}
No Hooks.
Returns
String. Formatted product name
Usage
$WC_Product = new WC_Product(); $WC_Product->get_formatted_name();
WC_Product::get_formatted_name() WC Product::get formatted name code WC 10.5.0
public function get_formatted_name() {
if ( $this->get_sku() ) {
$identifier = $this->get_sku();
} else {
$identifier = '#' . $this->get_id();
}
return sprintf( '%2$s (%1$s)', $identifier, $this->get_name() );
}