LLMS_Controller_Orders::complete_order( LLMS_Order $order, string $old_status )

Perform actions on a successful order completion


Parameters Parameters

$order

(LLMS_Order) (Required) Instance of an LLMS_Order.

$old_status

(string) (Required) Previous order status (eg: 'pending').


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/controllers/class.llms.controller.orders.php

	 *
	 * @param LLMS_Order $order      Instance of an LLMS_Order.
	 * @param string     $old_status Previous order status (eg: 'pending').
	 * @return void
	 */
	public function complete_order( $order, $old_status ) {

		// Clear expiration date when moving from a pending-cancel order.
		if ( 'pending-cancel' === $old_status ) {
			$order->set( 'date_access_expires', '' );
		}

		// Record access start time & maybe schedule expiration.
		$order->start_access();

		$order_id   = $order->get( 'id' );
		$product_id = $order->get( 'product_id' );
		$user_id    = $order->get( 'user_id' );

		unset( LLMS()->session->llms_coupon );

		/**
		 * Action fired on order complete.
		 *
		 * Prior to the students being enrolled.
		 *
		 * @since 1.0.0
		 *
		 * @param integer $order_id The WP_Post ID of the order.
		 */


Top ↑

Changelog Changelog

Changelog
Version Description
3.19.0 Unknown.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.