AD0-E725 practice question 6 of 10

A client wants to calculate tax differently when an order is billed for a range of particular postcodes. They want to implement their own system instead of using a third-party system. The Developer is asked to assist in this task by creating a conditional webhook. What must be done to achieve this?

Full set: 50 questions
Answer options
A: Create an after plugin on the webhook class and check for a list of postcodes at the time of processing and returning true for certain postcodes.
B: Create a webhooks.xml file and add the rules wanted in the form of a rule node element using the regex operator to catch a range of postcodes. Correct answer
C: Implement a new webhook with a list postcodes and link it to the original webhook, then advise the client to monitor for the new webhook instead.
Correct Answer:
B. Create a webhooks.xml file and add the rules wanted in the form of a rule node element using the regex operator to catch a range of postcodes.
Explanation

The standard and most efficient method to create a conditional webhook in Adobe Commerce is by using the declarative webhooks.xml configuration file. This file allows developers to define rules that filter events based on the payload data. By adding a block, a developer can specify a condition on the billingaddress.postcode field. The regexp (regular expression) operator is the appropriate choice for matching a range or pattern of postcodes, ensuring the webhook only triggers for the specified criteria.

Why Incorrect

A. A plugin would intercept the webhook processing logic, which is less efficient than declarative filtering. The goal is to prevent the webhook from triggering at all, not to alter its behavior during processing.
C. This describes a non-standard and overly complex approach. There is no native concept of "linking" webhooks, and this method does not address the core requirement of how to make the new webhook conditional.

References

1. Adobe Commerce Developer Documentation

Configure webhooks:

Section: Conditional webhooks

Content: "You can configure a webhook to be sent only when certain conditions are met. The conditions are defined in the element of the webhooks.xml file. Each element contains a field

operator

and value." This section explicitly details the use of the element to create conditional webhooks.

URL: https://developer.adobe.com/commerce/webapi/rest/webhooks/configure/

2. Adobe Commerce Developer Documentation

webhooks.xml reference:

Section: element

Content: This reference page lists the available operators for the element

which include eq

neq

gt

lt

in

nin

and regexp. The regexp operator is specified for matching values against a regular expression

which is ideal for the postcode range requirement.

URL: https://developer.adobe.com/commerce/webapi/rest/webhooks/webhooks-xml-reference/

Scroll to Top