WooCommerce::placing_order_from_admin( $order_id )

Place woocommerce order from the admin panel and sync it with course enrol


Parameters

$order_id

(Required)


Source

File: classes/WooCommerce.php

	public function placing_order_from_admin( $order_id ) {
		if ( ! is_admin() ) {
			return;
		}

		$order = wc_get_order( $order_id );

		foreach ( $order->get_items() as $item ) {
			$product_id  = $item->get_product_id();
			$customer_id = $order->get_customer_id();

			$course_ids = dozent_get_attached_course_ids_to_product( $product_id );

			if ( dozent_count( $course_ids ) ) {
				foreach ( $course_ids as $course_id ) {
					dozent_enrol_course( $course_id, $customer_id, $order_id );
				}
			}

		}
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.