the user can choose only one batch per course purchase

Home Forums WPLMS AddOns WPLMS Batches the user can choose only one batch per course purchase

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #239648
    eslammelegy
    Participant
    hi, now when the user purchase a course he can enrolled to all batches available. But I want to change this , how I can limit  one batch per 1 user per 1 purchase ? so when a new student pay for a course he can choose only one batch and he can't change the selected batch
    #239694
    Scott Lang
    Moderator
    Hi, There is no setting for this configuration so that we can restrict the single user to be add in only ine batch.
    #239731
    eslammelegy
    Participant
    that means If someone purchased a course he can spam all batches by enrolling to them all how to limit one batch to each user at each course ?
    #239763
    Scott Lang
    Moderator
    Hi, Ok, we will have to check if there is possibility.We will let you know. Please give us time to check.
    #239769
    eslammelegy
    Participant
    thanks waitting for your replay
    #239792
    eslammelegy
    Participant
    so is there any temporary solution for that ?
    #239954
    Scott Lang
    Moderator
    You can print a message to the user that you can not enroll in multiple batches and make cart empty. Refer this code add this to customizer:https://ctxt.io/2/AABAqot_FA  
    #244904
    eslammelegy
    Participant
    any updates ? the problem still here
    #245027
    Scott Lang
    Moderator
    We already shared code with you which is expired Here it is add this to your customizer plugin:
    add_action( 'woocommerce_before_cart_table', 'custom_add_to_cart_redirect' );
    function custom_add_to_cart_redirect() {
    $current_user_id = get_current_user_id();
    if(class_exists('WPLMS_Batch_Functions')){
    $wplms_batches = WPLMS_Batch_Functions::init();
    $batch_ids=$wplms_batches->get_user_batches($current_user_id);
    if(!empty($batch_ids) && count($batch_ids)){
    global $woocommerce;
    $woocommerce->cart->empty_cart();
    $message = __('You can not enroll in multiple batches','wplms-batches');
    wc_print_notice($message,'error');
    }
    }
    }
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘the user can choose only one batch per course purchase’ is closed to new replies.