J'utilise le plugin officiel de réservation woocommerce et j'essaie d'obtenir la quantité de toutes les personnes qui ont réservé un produit.
pour une seule commande, cela ne pose aucun problème :
if ( is_callable( 'WC_booking_Data_Store::get_booking_ids_from_order_id') ) {
$booking_data = new WC_booking_Data_Store();
$booking_ids = $booking_data->get_booking_ids_from_order_id( $order->get_id() );
}
foreach ( $booking_ids as $booking_id ) {
$booking = new WC_booking( $booking_id );
$person_count = array_sum( $booking->get_person_counts() );
$total_person_count .= 'Booking id: ' . $booking_id . ' Person Count: ' . $person_count . ' ';
}
mais comment puis-je collecter la somme de toutes les réservations ? J'espère que vous pourrez m'aider