function get_sub_total() { $sub_total = 0; $products = $this->get_products(); if ($products) { foreach ($products as $product) { $sub_total += learn_press_is_free_course($product['id']) ? 0 : floatval(learn_press_get_course_price($product['id'])); } } learn_press_format_price($sub_total); return apply_filters('learn_press_get_cart_subtotal', $sub_total, $this->get_cart_id()); }
<form id="learn_press_payment_form" name="learn_press_payment_form" method="post"> <?php if (!learn_press_is_free_course()) { $gateways = LPR_Gateways::instance()->get_available_payment_gateways(); ?> <ul id="lpr-payment-tab" class="nav nav-tabs" role="tablist"> <?php do_action('learn_press_before_payment_loop'); $i = 0; foreach ($gateways as $slug => $gateway) { $gateway = apply_filters('learn_press_print_payment_' . $slug, $gateway); if (!$gateway) { continue; } ?> <li> <label><input type="radio" name="payment_method" value="<?php echo $slug; ?> " /> <?php echo $gateway; ?> </label> <div class="learn_press_payment_form" id="learn_press_payment_form_<?php echo $slug; ?> "> <?php do_action('learn_press_payment_gateway_form_' . $slug); ?> </div>
/** * @param $order_id * @return array|bool */ function learn_press_get_transition_products($order_id) { $order_items = get_post_meta($order_id, '_learn_press_order_items', true); $products = false; if ($order_items) { if (!empty($order_items->products)) { $products = array(); foreach ($order_items->products as $pro) { $product = get_post($pro['id']); if ($product) { $product->price = $pro['price']; $product->quantity = $pro['quantity']; $product->amount = learn_press_is_free_course($pro['id']) ? 0 : $product->price * $product->quantity; $products[] = $product; } } } } return $products; }