Course name on Woocommerce Order

Home Forums Legacy Support Support queries Setup issues Course name on Woocommerce Order

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #236216
    mongrelgear
    Spectator
    Hi all,   Is it possible to get the course name on the Woocommerce order?  I ask because we have courses running every week in different locations that have different names.  That said, they are all the same course (as far as a sellable product is concerned) but it's impossible to tell what course they have signed up to by looking at the order!  🙁   Thanks   John
    #236317
    Veronica
    Moderator
    Hello, no there is nothing like that but you can trick this. use a plugin to add the checkout field in your woocommerce checkout. suppose the classes are running for #newyork city then add a field course location in the checkout page. make this field mandatory. when the user will be redirected to the checkout page, he must fill this field. now this will be added in the order. now you can easily differentiate between the orders. but for this feature, you will have to use this plugin:

    to add/remove fields, have a look here on official docs: https://docs.woocommerce.com/document/checkout-field-editor/

    #236384
    mongrelgear
    Spectator
    Hmm.. Thanks, but this is not ideal! We run multiple courses in the same city, on different date etc.  I would have thought this would be a necessity in such an LMS like yours!!  How else can we see what exactly has been purchased. This is really not ideal at all for an online system. We must be able to identify what course, at what location, the customer has paid for.  :(
    #236494
    Anshuman Sahu
    Keymaster
    Can you please share where do you want to show the course exactly ? In the cart ? on checkout ? and on order confirmation page as well?
    #236495
    Anshuman Sahu
    Keymaster
    here is the code to show the course name in cart and checkout pages : please try adding this given code in your wplms-customizer.php file in wplms customizer plugin : add_filter('woocommerce_get_item_data','wdm_get_item_meta',10,2); function wdm_get_item_meta($item_data, $cart_item){   $product_id = $cart_item['product_id'];     if ( empty( $product_id )) {         return $item_data;     }       $courses = get_post_meta($product_id,'vibe_courses',true);     if(!empty($courses)){       foreach ($courses as $key => $course_id) {         $item_data[] = array(             'key'   => _x('Course','','wplms'),             'value' => get_the_title($course_id),         );       }     }     return $item_data; }
    #236517
    mongrelgear
    Spectator
    Thanks, I will give that a try.  Let me try and explain what we have.... We run specialised courses for small class sizes.  They run for a week at a time, and are scattered all over the country.  These are face to face, not online. What we want to be able to do is look at Woocommerce, and see exactly what the customer enrolled in, and where. At the moment we are having to create a product for every single course we run in every location, instead of having the LMS course link to one product.  This is because if we use one product, every Woocommerce order will show the same product for every student, no matter what course they enrolled in. Does that make sense? So - if we were to go back to an order 3 months from now, I have no way of knowing what course it was, without having to go digging through to find it!  Simply looking at the order would tell me - IF - we could get the course name into the order.   Cheers John    
    #236591
    Veronica
    Moderator
    hello, please provide the screenshot where you want to show the course name. then we can check it.
    #236741
    mongrelgear
    Spectator
    We simply want it in the order in Woocommerce - So instead of only the product name, it has the LMS course that the student enrolled in.  Right now, if I get 3 orders come in from 3 different customers, the orders tell me nothing about what course the have enrolled in!
    #236873
    Anshuman Sahu
    Keymaster
    Ok so you want it in backend ? Can you please share a screenshot of the screen where exactly you want it?
    #236943
    mongrelgear
    Spectator
    Below is screen shot link.  I can't attach here and can't remember what you use for screen shots here. Anyways... you will see the WooCommerce order with the product I have created that matches exactly the same name as the course, as it's the only way I can track anything.  I want the course name there.... https://www.dropbox.com/s/ie10b69np2m6aye/Screen.jpg?dl=0   Thanks John
    #237024
    Anshuman Sahu
    Keymaster
    please try adding this given code in your wplms-customizer.php file in wplms customizer plugin :   add_action( 'woocommerce_admin_order_data_after_order_details', 'misha_editable_order_meta_general' );   function misha_editable_order_meta_general( $order ){     $items = $order->get_items();   $user_id=$order->get_user_id();   $order_total = $order->get_total();   foreach($items as $item_id=>$item){         $instructors=array();            $courses=get_post_meta($item['product_id'],'vibe_courses',true);         $product_id = apply_filters('bp_course_product_id',$item['product_id'],$item);         if(isset($courses) && is_array($courses)){           foreach ($courses as $key => $course_id) {             echo '<br><br><h3 style="margin-top: 1em;display: inline-block;clear: both;width: 100%;"> Course : '.get_the_title($course_id).'</h3>';           }       }   } }
Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Course name on Woocommerce Order’ is closed to new replies.