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

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);