Automattic\WooCommerce\Internal\StockNotifications
Notification::save
Save the notification.
Метод класса: Notification{}
Хуков нет.
Возвращает
int|\WP_Error. The notification ID or a WP_Error if the save failed.
Использование
$Notification = new Notification(); $Notification->save();
Код Notification::save() Notification::save WC 10.5.2
public function save() {
if ( ! $this->data_store ) {
return $this->get_id();
}
try {
$this->validate_props();
} catch ( \WC_Data_Exception $e ) {
return new \WP_Error( 'stock_notification_validation_error', $e->getMessage() );
}
if ( $this->get_id() ) {
$this->data_store->update( $this );
} else {
$this->data_store->create( $this );
}
return $this->get_id();
}