Automattic\WooCommerce\Internal\Admin
OrderMilestoneEasterEgg::get_milestone_map
Returns a map of milestone order IDs to their milestone data.
Uses cached milestone order IDs when available; otherwise computes and caches them by scanning qualifying orders in chronological order.
Method of the class: OrderMilestoneEasterEgg{}
Hooks from the method
Returns
Array
Usage
// private - for code of main (parent) class only $result = $this->get_milestone_map(): array;
OrderMilestoneEasterEgg::get_milestone_map() OrderMilestoneEasterEgg::get milestone map code WC 10.9.1
private function get_milestone_map(): array {
$milestone_order_ids = $this->get_cached_milestone_order_ids();
if ( null === $milestone_order_ids ) {
$milestone_order_ids = $this->compute_milestone_order_ids();
update_option( self::MILESTONE_CACHE_OPTION, $milestone_order_ids, false );
$this->update_milestones_complete_option( $milestone_order_ids );
}
$messages = $this->get_milestone_messages();
$milestone_map = array();
foreach ( $milestone_order_ids as $key => $order_id ) {
if ( isset( $messages[ $key ] ) ) {
$milestone_map[ $order_id ] = $messages[ $key ];
}
}
/**
* Filters the map of milestone order IDs to their milestone data.
*
* @param array<int, array<string, string>> $milestone_map Map of order ID to milestone data.
*
* @since 10.9.0
*/
return apply_filters( 'wc_order_milestone_egg_map', $milestone_map );
}