Tribe__Tickets_Plus__Commerce__WooCommerce__Promoter_Observer::order_updated( $order )

If an order is updated find the ID of the product to notify the event that the product has been updated.


Parameters #

$order

(Required) bool|WC_Abstract_Order|int Reference to the Woo Order.


Top ↑

Source #

File: src/Tribe/Commerce/WooCommerce/Promoter_Observer.php

	public function order_updated( $order ) {
		if (
			! function_exists( 'wc_get_order' )
			|| ! class_exists( 'WC_Abstract_Order' )
			|| ! class_exists( 'WC_Order_Item_Product' )
		) {
			return;
		}

		if ( ! $order instanceof WC_Abstract_Order ) {
			$order = wc_get_order( $order );
		}

		$data = [];

		if ( $order instanceof WC_Abstract_Order ) {
			$data = $order->get_items();
		}

		$data = is_array( $data ) ? $data : [];

		foreach ( $data as $item ) {
			if ( $item instanceof WC_Order_Item_Product ) {
				$this->observer->notify_ticket_event( $item->get_product_id() );
			}
		}
	}

Top ↑

Changelog #

Changelog
Version Description
TBD Introduced.