Automattic\WooCommerce\Internal\PushNotifications\Notifications
StockNotification::to_array
{@inheritDoc}
Extends the parent array with event_type and the trigger-time stock snapshot so both fields survive serialization through the safety-net scheduler and the internal-REST round-trip.
Method of the class: StockNotification{}
No Hooks.
Returns
Array{type:. string, resource_id: int, event_type: string, stock_quantity_at_trigger: int|null}
Usage
$StockNotification = new StockNotification(); $StockNotification->to_array(): array;
Changelog
| Since 10.9.0 | Introduced. |
StockNotification::to_array() StockNotification::to array code WC 10.9.1
public function to_array(): array {
return array_merge(
parent::to_array(),
array(
'event_type' => $this->event_type,
'stock_quantity_at_trigger' => $this->stock_quantity_at_trigger,
)
);
}