WooCommerce::order_status_changed( $order_id,  $status_from,  $status_to )


Source

File: classes/WooCommerce.php

	public function order_status_changed( $order_id, $status_from, $status_to ) {
		$order = wc_get_order( $order_id );

		if ( $order ) {
			if ( $status_to === 'completed' ) {
				$status_to = 'active';
			}

			$enrolments = dozent_get_enrolments_by_order( $order_id );

			if ( dozent_count( $enrolments ) ) {
				foreach ( $enrolments as $enrolment ) {
					$enrolmentModel = new Enrol( $enrolment->ID );
					$enrolmentModel->update_status( $status_to );
				}
			}
		}
	}