Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/LearnPress/learnpress in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
tungnxt89 committed May 2, 2024
2 parents db1588e + 45a346e commit a09b752
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion inc/order/class-lp-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,18 @@ public function remove_item( $item_id ) {
*/
do_action( 'learn-press/before-delete-order-item', $item_id, $this->get_id() );

$course_id = learn_press_get_order_item_meta( $item_id, '_course_id' );
if ( ! empty( $course_id ) ) {
$user_ids = $this->get_user_id();
if ( is_array( $user_ids ) ) {
foreach ( $user_ids as $user_id ) {
LP_User_Items_DB::getInstance()->delete_user_items_old( (int) $user_id, (int) $course_id );
}
} else {
LP_User_Items_DB::getInstance()->delete_user_items_old( (int) $user_ids, (int) $course_id );
}
}

$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}learnpress_order_items WHERE order_item_id = %d", $item_id ) );
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}learnpress_order_itemmeta WHERE learnpress_order_item_id = %d", $item_id ) );

Expand Down Expand Up @@ -826,7 +838,6 @@ public function dropdown_users() {


public function get_checkout_payment_url() {

}

public function get_formatted_order_subtotal() {
Expand Down

0 comments on commit a09b752

Please sign in to comment.