WooCommerce::placing_order_from_frontend( int $item_id, object $item, int $order_id )

Course placing order from customer


Description

Example usage:

placing_order_from_frontend();

more description Note: if any

See also


Parameters

$item_id

(int) (Required) Product ID

$item

(object) (Required) Product

$order_id

(int) (Required) Order ID


Source

File: classes/WooCommerce.php

	public function placing_order_from_frontend( $item_id, $item, $order_id ) {
		if ( is_admin() ) {
			return;
		}

		$order       = wc_get_order( $order_id );
		$item        = new \WC_Order_Item_Product( $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.