Automattic\WooCommerce\Internal\StockNotifications

Notification::has_meta_changes │ public │ WC 11.4.0

Whether any meta changes are pending a save.

Mirrors the checks in save_meta_data(), so meta marked for deletion counts, unlike get_meta_data().

Method of the class: Notification{}

No Hooks.

Returns

bool.

Usage

$Notification = new Notification();
$Notification->has_meta_changes(): bool;

Changelog

Since 11.4.0 Introduced.

Notification::has_meta_changes() code WC 11.3.0

public function has_meta_changes(): bool {
	if ( is_null( $this->meta_data ) ) {
		return false;
	}

	foreach ( $this->meta_data as $meta ) {
		if ( is_null( $meta->value ) ) {
			if ( ! empty( $meta->id ) ) {
				return true;
			}
		} elseif ( empty( $meta->id ) || $meta->get_changes() ) {
			return true;
		}
	}

	return false;
}