Noptin_WooCommerce_New_Order_Trigger::is_rule_valid_for_args( $rule, $args, $subscriber, $action )
Contents
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; }
Expand full source code Collapse full source code View on GitHub