$condition Condition config. * @param array $context Workflow context. * @return bool */ public function evaluate( array $condition, array $context ): bool { $order_id = $context['order_id'] ?? null; if ( null === $order_id ) { return false; } $order = wc_get_order( $order_id ); if ( ! $order ) { return false; } $operator = trim($condition['operator'] ?? ''); $expected = trim($condition['value'] ?? ''); $variable = trim($condition['variable'] ?? ''); if ('' === $operator || !method_exists($this, $operator) || '' === $expected || '' === $variable) { return false; } $wooVariables = Variables::fromOrderInstance($order); $variableValue = $wooVariables->get($variable); if (empty($variableValue)) { Log::info("GenericCondition: {$variable} returned empty value => ", ['order_id' => $order_id]); return false; } $eval = $this->$operator($variableValue, $expected); return $eval; } }