Adobe AD0-E716 Practice Test - Questions Answers, Page 5
List of questions
Question 41

An Adobe Commerce developer is asked to create a new payment method for their project. This project has administrators who use the backend to manage customer information and occasionally place orders. When testing the new payment method on the frontend everything worked as expected, however, the payment method is missing in the admin.
What is a possible reason for this?
Question 42

An Adobe Commerce developer is asked to implement a 15% surcharge for all users from a 'Wholesale' customer group. Keeping best practices in mind, what is a correct to accomplish this?
Explanation:
The possible reason why the payment method is missing in the admin is that in the module config.xml, the node can_use_internal was not set to true. This node determines whether the payment method can be used in the admin area or not. If it is set to false or omitted, the payment method will not be available for admin orders. To enable the payment method for admin use only, the node can_use_internal should be set to true and the node can_use_checkout should be set to false. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 43

There is an integration developed using a cron service that runs twice a day, sending the Order ID to the integrated ERP system if there are orders that are able to create an invoice. The order is already loaded with the following code:
$order = $this->orderRepository->get($orderId);
In order to verify if the store has invoices to be created, what implementation would the Adobe Commerce developer use?
A)
B)
C)
Explanation:
The developer can use the canInvoice method of the order object to check if the order can be invoiced or not. This method returns true if the order has a state of new, processing, or payment review and has not been fully invoiced yet. The developer can use this method in a conditional statement to send the order ID to the ERP system only if the order can be invoiced. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 44

An Adobe Commerce developer has created a new shipping carrier Everything has been implemented and the collectRates() and getAllowedMethodsQ functions can be seen below:
Given the above code, what would be the displayed cost of the shipping method and final amount charged to the customer?
Explanation:
The shipping method would display $10 and customers would pay $10 for using the new shipping method. This is because the collectRates method sets the price and cost of the shipping method to 10 in the result object. The price is what is shown to the customer on the frontend and the cost is what is charged to the customer when they place the order. The handling fee is not used in this case because it is set to zero in the config.xml file. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 45

An Adobe Commerce developer is creating a new module to extend the functionality of the cart. The module is installed in app/code/CompanyName/ModuleName/.
How would an Adobe Commerce developer extend the existing CartltemPrices GraphQL schema to include a custom base_price field?
Explanation:
The developer can extend the existing CartltemPrices GraphQL schema to include a custom base_price field by adding the following code to the module's etc/schema.graphqls file:
extend type CartltemPrices { base_price: Money! @doc(description: ''The base price of the cart item'') }
This code adds a new field called base_price to the CartltemPrices type and specifies that it is of type Money and it is not nullable. The @doc directive adds a description for the field that will be shown in the schema documentation. The developer also needs to create a custom resolver class for the base_price field and declare it in the di.xml file of the module. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 46

An Adobe Commerce developer added a new API method to search and retrieve a list of Posts for a custom Blog functionality. This is the content of the module's etc/webapi.xml file:
The new code has been deployed to production and the merchant is using https: //merchant. domain. com/swagger to review the new endpoint, but it is not visible in swagger.
What would be a reason for this?
Explanation:
The reason why the new endpoint is not visible in swagger is that since the new endpoint is not anonymous, the merchant needs to enter a valid integration token in swagger in order to see the new method. The webapi.xml file specifies that the resource for the new endpoint is MyVendor_Blog::post, which means that only authorized users with this permission can access it. To generate an integration token, the merchant needs to create an integration in the admin panel and activate it. Then they can copy the token and paste it in swagger's authorization field. Verified
Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]
Question 47

A message queue currently has queue/consumer-wait-for-messages set to true, which allows the consumer process to run until a message is inserted into the queue. A piece of functionality is driven by data stored in the model
\Magento\variable\Model\variable and this value is only loaded once during the consumer run. If the variable is updated we want the consumer to restart so that the new value is loaded into memory without having to reload the variable on each message consumed.
The Adobe Commerce developer has created an after plugin on the \Magento\Variable\Model\variable:: save() function.
How would the developer use the plugin to trigger the consumer restart?
Explanation:
The developer can use the plugin to trigger the consumer restart by calling the function \Magento\Framework\MessageQueue\Consumers\TriggerRe5tartInterface:trigger(). This function will write a flag to the cache storage that will be checked by the consumer process.If the flag is set, the consumer process will terminate itself and restart with the updated configuration. Verified
Reference: [Magento 2.4 DevDocs]1
Question 48

How would a developer enable the magnification of CSS files on an Adobe Commerce Cloud Staging environment?
Explanation:
The developer can enable the magnification of CSS files on an Adobe Commerce Cloud Staging environment by locally running the command bin/magento config:set --lock-config dev/css/minify_files 1 from the command line. This will set the configuration value in the app/etc/config.php file and lock it from being changed in the Admin Panel.The developer then needs to commit the app/etc/config.php file and redeploy the environment. Verified
Reference: [Magento 2.4 DevDocs]2
Question 49

A merchant of an Adobe Commerce Cloud project wants to setup one of their websites using a subdomain. The merchant is considering the domain to be set as secondstore.example.com.
In addition to editing the magento-vars.php file, and apply a domain check and set $_SERVER['MAGE_RUN_CODE'] and $_SERVER['MAGE_RUN_TYPE'].
What file is required to perform this action?
Explanation:
The developer can set up a subdomain for one of their websites by configuring the subdomain route in the .magento/routes.yaml file. This file defines how incoming requests are routed to different applications or services on the Adobe Commerce Cloud platform. The developer needs to add a route for secondstore.example.com and map it to the same application as example.com.The developer also needs to specify the upstream variable for secondstore.example.com as MAGE_RUN_CODE and MAGE_RUN_TYPE. Verified
Reference: [Magento 2.4 DevDocs]3
Question 50

What is the command used to upgrade ECE-Tools on an Adobe Commerce Cloud platform?
Explanation:
The command used to upgrade ECE-Tools on an Adobe Commerce Cloud platform is composer update magento/ece-tools --with-all-dependencies. This command will update the ECE-Tools package and its dependencies to the latest version available in the composer repository. The developer then needs to commit and push the changes to the composer.json and composer.lock files and redeploy the environment. Verified
Reference: [Magento 2.4 DevDocs]
Question