Automattic\WooCommerce\Internal\StockNotifications\Frontend
MyAccountEndpoint::get_display_product_name
Product name to show as the row label.
Notification::get_product_name() returns the variation name, which already carries the attributes ("Hoodie - Blue, Large"). The row renders those attributes separately underneath, so use the parent title here and let the variation list own them.
Method of the class: MyAccountEndpoint{}
No Hooks.
Returns
string. Product name, or an empty string when the product is gone.
Usage
$result = MyAccountEndpoint::get_display_product_name( $notification ): string;
- $notification(Notification) (required)
- The notification to label.
MyAccountEndpoint::get_display_product_name() MyAccountEndpoint::get display product name code WC 11.2.1
public static function get_display_product_name( Notification $notification ): string {
$product = $notification->get_product();
if ( ! $product ) {
return '';
}
return (string) $product->get_title();
}