src/WooCommerce/Invoice/CreatorPluginSupport.php
public function getItemLineBeforeBookings(Creator $creator, WC_Order_Item_Product $item, $product)
    {
        if ($product instanceof WC_Product) {
            if (function_exists('is_wc_booking_product') && is_wc_booking_product($product)) {
                $booking_ids = WC_Booking_Data_Store::get_booking_ids_from_order_item_id($item->get_id());
                if ($booking_ids) {
                    // I cannot imagine multiple bookings belonging to the same
                    // order line, but if that occurs, only the 1st booking will
                    // be added as a property source.
                    $booking = new WC_Booking(reset($booking_ids));
                    $creator->addPropertySource('booking', $booking);
                    $resource = $booking->get_resource();
                    if ($resource) {
                        $creator->addPropertySource('resource', $resource);
                    }
                }
            }
        }
    }
public function getItemLineBeforeBookings(Creator $creator, WC_Order_Item_Product $item, $product)
    {
        if ($product instanceof WC_Product) {
            if (function_exists('is_wc_booking_product') && is_wc_booking_product($product)) {
                $booking_ids = WC_Booking_Data_Store::get_booking_ids_from_order_item_id($item->get_id());
                if ($booking_ids) {
                    // I cannot imagine multiple bookings belonging to the same
                    // order line, but if that occurs, only the 1st booking will
                    // be added as a property source.
                    $booking = new WC_Booking(reset($booking_ids));
                    $creator->addPropertySource('booking', $booking);
                    $resource = $booking->get_resource();
                    if ($resource) {
                        $creator->addPropertySource('resource', $resource);
                    }
                }
            }
        }
    }
public function getItemLineBeforeBookings ( Creator $ creator , WC_Order_Item_Product $ item , $ product ) { if ( $ product instanceof WC_Product ) { if ( function_exists ( 'is_wc_booking_product' ) && is_wc_booking_product ( $ product ) ) { $ booking_ids = WC_Booking_Data_Store :: get_booking_ids_from_order_item_id ( $ item -> get_id ( ) ) ; if ( $ booking_ids ) { // I cannot imagine multiple bookings belonging to the same // order line, but if that occurs, only the 1st booking will // be added as a property source. $ booking = new WC_Booking ( reset ( $ booking_ids ) ) ; $ creator -> addPropertySource ( 'booking' , $ booking ) ; $ resource = $ booking -> get_resource ( ) ; if ( $ resource ) { $ creator -> addPropertySource ( 'resource' , $ resource ) ; } } } } }
Support for the "WooCommerce Bookings" plugin.

Bookings are stored in a separate entity, we add that as a separate
property source, so its properties can be used.

@param \Siel\Acumulus\WooCommerce\Invoice\Creator $creator
@param WC_Order_Item_Product $item
@param WC_Product|bool $product
Support for the WooCommerce Bookings plugin .