Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Evaluating conditional expressions

Evaluating conditional expressions

The ConditionEvaluatorService is used to evaluate a tag set against Creating conditional expressions. The evaluateConditionOnTags method of the ConditionEvaluatorService takes a tag set and a conditional expression as arguments and returns true if all the values in the tag set meet the criteria of the conditional statement.

import com.elasticpath.tags.service.ConditionEvaluatorService;
...
ConditionEvaluatorService evaluatorService =
        (ConditionEvaluatorService) getBeanByName(ContextIdNames.TAG_CONDITION_EVALUATOR_SERVICE);
boolean result = evaluatorService.evaluateConditionOnTags(tagSet, condExpr);