WC_VIEWPRODUCT::view_woo_product()


Source Source

File: src/integrations/woocommerce/triggers/wc-viewproduct.php

	public function view_woo_product() {



		global $post;

		if ( 'product' !== $post->post_type ) {
			return;
		}

		$user_id = get_current_user_id();
		$args    = [
			'code'    => $this->trigger_code,
			'meta'    => $this->trigger_meta,
			'post_id' => $post->ID,
			'user_id' => $user_id,
		];

		$arr = Automator()->maybe_add_trigger_entry( $args, false );

		if ( $arr ) {
			foreach ( $arr as $result ) {
				if ( true === $result['result'] ) {
					Automator()->maybe_trigger_complete( $result['args'] );
				}
			}
		}
	}