get_product(); $product_b = $b->get_product(); if ( is_object( $product_a ) && is_object( $product_b ) ) { $type_a = $product_a->get_type(); $type_b = $product_b->get_type(); // Move 'car_option' to the end if ( 'car_option' === $type_a && 'car_option' !== $type_b ) { return 1; } elseif ( 'car_option' !== $type_a && 'car_option' === $type_b ) { return -1; } } return 0; } } $items = array_values( $items ); usort( $items, 'sort_items_by_car_option' ); foreach ( $items as $item_id => $item ) : $product = $item->get_product(); $sku = ''; $purchase_note = ''; $image = ''; if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) { continue; } if ( is_object( $product ) ) { $sku = $product->get_sku(); $purchase_note = $product->get_purchase_note(); $image = $product->get_image( $image_size ); $product_type = $product->get_type(); } //additional data for order info in rental if ( apply_filters( 'stm_is_rental', false ) && function_exists( 'stm_get_rental_order_fields_values' ) ) { $cart_items = stm_get_cart_items(); $product_id = ( 'variation' === $product_type ) ? $cart_items['car_class']['id'] : $product->get_id(); $car_options = $cart_items['options']; $order_days = $cart_items['car_class']['days']; $order_hours = isset( $cart_items['car_class']['hours'] ) ? $cart_items['car_class']['hours'] : 0; $car_price = $cart_items['car_class']['price']; $order_total = ''; $fixedPrice = ( class_exists( 'PriceForQuantityDays' ) ) ? PriceForQuantityDays::getFixedPrice( $product_id ) : null; $priceDate = PriceForDatePeriod::getDescribeTotalByDays( $car_price, $product_id ); $priceDateSimpleDays = count( $priceDate['simple_price'] ); $priceDateSimplePrice = $priceDate['simple_price'][0]; $priceDateTotal = array_sum( $priceDate['promo_price'] ); $pricePerHour = floatval( get_post_meta( $product_id, 'rental_price_per_hour_info', true ) ); $pricePerHourTotal = $pricePerHour * $order_hours; $discount = ( class_exists( 'DiscountByDays' ) ) ? DiscountByDays::get_days_post_meta( $product_id ) : null; $fields = stm_get_rental_order_fields_values(); $location_fee = 0; if ( 'car_option' !== $product_type ) { if ( ! empty( $fixedPrice ) ) { $order_total = $fixedPrice * $priceDateSimpleDays; } else { $order_total = $priceDateSimpleDays * $priceDateSimplePrice; } if ( ! empty( $priceDate ) && count( $priceDate['promo_price'] ) > 0 ) { $order_total += $priceDateTotal; } if ( ! empty( $pricePerHour ) ) { $order_total += $pricePerHourTotal; } } if ( 'on' === $fields['return_same'] && apply_filters( 'stm_me_get_nuxy_mod', true, 'enable_fee_for_same_location' ) && ! empty( $fields['pickup_location_fee'] ) ) { $location_fee = $fields['pickup_location_fee']; } elseif ( 'off' === $fields['return_same'] && ! empty( $fields['return_location_fee'] ) ) { $location_fee = $fields['return_location_fee']; } } ?> get_name(), $item, false ) ); // SKU. if ( $show_sku && $sku ) { echo wp_kses_post( ' (#' . $sku . ')' ); } // allow other plugins to add additional product information here. do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, $plain_text ); wc_display_item_meta( $item, array( 'label_before' => '', ) ); // allow other plugins to add additional product information here. do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text ); ?> get_quantity(); $refunded_qty = $order->get_qty_refunded_for_item( $item_id ); if ( $refunded_qty ) { $qty_display = '' . esc_html( $qty ) . ' ' . esc_html( $qty - ( $refunded_qty * -1 ) ) . ''; } else { $qty_display = esc_html( $qty ); } echo wp_kses_post( apply_filters( 'woocommerce_email_order_item_quantity', $qty_display, $item ) ); ?>
0 ) : ?> $val ) : $period_total_price = $val * $k; ?> $val ) { if ( $val['days'] <= $order_days ) { $days = $val['days']; $currentDiscount = $val['percent']; } } $forDiscount = $order_total; $order_total = $order_total - ( ( $order_total / 100 ) * $currentDiscount ); ?>
get_formatted_line_subtotal( $item ) ); ?>