PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | inc/cart/lp-cart-functions.php +15 -9 4.1.7.2 → 4.4.9 View file →
@@ -1,11 +1,11 @@
1 1 <?php
2 2 /**
3 3 * Return LP_Cart object instance
4 4 *
5 - * @return mixed
5 + * @return LP_Cart
6 6 */
7 -function learn_press_get_cart() {
7 +function learn_press_get_cart(): LP_Cart {
8 8 return LearnPress::instance()->cart;
9 9 }
10 10
11 11 function learn_press_enable_cart() {
@@ -47,13 +47,18 @@
47 47 /**
48 48 * Return total of cart
49 49 *
50 50 * @return mixed
51 + * @deprecated 4.2.0
51 52 */
52 53 function learn_press_get_cart_total() {
54 + _deprecated_function( __FUNCTION__, '4.2.0' );
53 55 return LearnPress::instance()->cart->total;
54 56 }
55 57
58 +/**
59 + * @deprecated 4.2.0
60 + */
56 61 function learn_press_clear_cart_after_payment() {
57 62 global $wp;
58 63
59 64 if ( ! empty( $wp->query_vars['lp-order-received'] ) ) {
@@ -67,27 +72,28 @@
67 72 }
68 73 }
69 74 }
70 75
71 - if ( ! is_null( LearnPress::instance()->session ) && LearnPress::instance()->session->order_awaiting_payment > 0 ) {
72 - $order = learn_press_get_order( LearnPress::instance()->session->order_awaiting_payment );
76 + if ( ! is_null( LearnPress::instance()->session ) && LearnPress::instance()->session->get( 'order_awaiting_payment' ) > 0 ) {
77 + $order = learn_press_get_order( LearnPress::instance()->session->get( 'order_awaiting_payment' ) );
73 78
74 79 if ( $order && $order->id > 0 ) {
75 80 if ( ! $order->has_status( array( 'failed', 'pending', 'cancelled' ) ) ) {
76 81 LearnPress::instance()->cart->empty_cart();
77 - LearnPress::instance()->session->order_awaiting_payment = null;
82 + LearnPress::instance()->session->remove( 'order_awaiting_payment' );
78 83 }
79 84 }
80 85 }
81 86 }
82 -add_action( 'get_header', 'learn_press_clear_cart_after_payment' );
87 +//add_action( 'get_header', 'learn_press_clear_cart_after_payment' );
83 88
84 89 /**
85 90 * @param LP_Cart $cart
86 91 *
87 92 * @return mixed
93 + * @deprecated 4.2.0
88 94 */
89 -function learn_press_custom_checkout_cart( $cart ) {
95 +/*function learn_press_custom_checkout_cart( $cart ) {
90 96 if ( empty( $_REQUEST['single-item'] ) ) {
91 97 return $cart;
92 98 }
93 99
@@ -99,6 +105,6 @@
99 105 $cart->add_to_cart( $item );
100 106 }
101 107
102 108 return $cart;
103 -}
104 -add_filter( 'learn_press_checkout_cart', 'learn_press_custom_checkout_cart' );
109 +}*/
110 +//add_filter( 'learn_press_checkout_cart', 'learn_press_custom_checkout_cart' );