Automattic\WooCommerce\Internal\StockNotifications
Factory::create_dummy_notification
Create a dummy notification for preview/testing purposes.
Method of the class: Factory{}
No Hooks.
Returns
Notification.
Usage
$result = Factory::create_dummy_notification(): Notification;
Factory::create_dummy_notification() Factory::create dummy notification code WC 10.3.6
public static function create_dummy_notification(): Notification {
$notification = new Notification();
// Create a dummy product.
$product = new \WC_Product();
$product->set_name( __( 'Dummy Product', 'woocommerce' ) );
$product->set_price( 25 );
$product->set_image_id( get_option( 'woocommerce_placeholder_image', 0 ) );
// Set required notification data.
$notification->set_product_id( $product->get_id() );
$notification->set_user_email( '[email protected]' );
// Store the dummy product in the notification object for preview.
$notification->product = $product;
return $notification;
}