Noptin_WooCommerce_New_Order_Trigger::is_rule_valid_for_args( $rule,  $args,  $subscriber,  $action )


Source Source

File: includes/automation-rules/triggers/class-noptin-woocommerce-new-order-trigger.php

    public function is_rule_valid_for_args( $rule, $args, $subscriber, $action ) {
        $settings = $rule->trigger_settings;

        // Ensure that we have an action for this event.
        if ( empty( $settings['action'] ) || $settings['action'] !== $args['action'] ) {
            return false;
        }

        // Are we firering for new customers only?
        if ( ! empty( $settings['new_customer'] ) ) {

            // Fetch the user associated with the order.
            $user = $this->bridge->get_order_customer_user_id( $args['order_id'] );
            if ( empty( $user ) ) {
                $user = $this->bridge->get_order_customer_email( $args['order_id'] );
            }

            return $this->bridge->get_order_count( $user ) === 1;
        }

        return true;

    }

Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation