- 1 ) ) as $product ) { $products[] = $product; if ( $product->get_type() === 'variable' ) { foreach ( $product->get_children() as $variation_id ) { $products[] = wc_get_product( $variation_id ); } } } return $products; } public static function exists() { return class_exists( 'WooCommerce', false ); } public static function do_woocommerce_refund_product_action( $order_id ) { $order = wc_get_order( $order_id ); $user = get_user_by( 'id', $order->get_report_customer_id() ); $billing_email = $order->get_billing_email(); foreach ( $order->get_items() as $product ) { if ( $product->get_quantity() != 0 ) { do_action( 'thrive_woo_product_refund', $product, $user, $billing_email ); } } } public static function do_woocommerce_product_purchase_completed( $order_id ) { $order = wc_get_order( $order_id ); $user = get_user_by( 'id', $order->get_customer_id() ); $billing_email = $order->get_billing_email(); foreach ( $order->get_items() as $product ) { do_action( 'thrive_woo_product_purchase_completed', $product, $user, $billing_email ); } } public static function do_woocommerce_product_purchase_processing( $order_id ) { $order = wc_get_order( $order_id ); $user = get_user_by( 'id', $order->get_customer_id() ); $billing_email = $order->get_billing_email(); foreach ( $order->get_items() as $product ) { do_action( 'thrive_woo_product_purchase_processing', $product, $user, $billing_email ); } } }