__('Equal to', 'advance-notification-for-woocommerce'), 'neq' => __('Not equal to', 'advance-notification-for-woocommerce'), 'gt' => __('Greater than', 'advance-notification-for-woocommerce'), 'gte' => __('Greater than or equal to', 'advance-notification-for-woocommerce'), 'lt' => __('Less than', 'advance-notification-for-woocommerce'), 'lte' => __('Less than or equal to', 'advance-notification-for-woocommerce'), ); } /** * Get HTML for value field * * @param string $html Current HTML. * @param string $condition_id Condition ID. * @param string $unused_param Unused parameter. * @param string $current_value Current value. * @return string */ public function get_value_field($html, $condition_id, $unused_param, $current_value) { ob_start(); ?>
is_match_for_new_order($return, $data, $trigger_type, $operator, $value); } return false; } public function is_match_for_new_order($return, $data, $trigger_type, $operator, $value) { $order = isset($data['order']) ? $data['order'] : null; if (!$order || !is_a($order, 'WC_Order')) { return false; } $subtotal = $order->get_subtotal(); $value = (float) $value; switch ($operator) { case 'eq': return $subtotal == $value; case 'neq': return $subtotal != $value; case 'gt': return $subtotal > $value; case 'gte': return $subtotal >= $value; case 'lt': return $subtotal < $value; case 'lte': return $subtotal <= $value; default: return false; } } }