162 Practice Questions & Answers
You are developing a custom module that needs to intercept product save events. Which plugin type should you use to modify product data before it is persisted to the database?
-
A
afterPlugin on ProductRepository::save()
-
B
beforePlugin on ProductRepository::save()
✓ Correct
-
C
aroundPlugin on ProductRepository::save()
-
D
observerPlugin on catalog_product_save_before
Explanation
A beforePlugin intercepts the method call before execution, allowing you to modify the product data before it reaches the save method. This is the appropriate choice for data validation and modification before persistence.
When implementing a custom payment method, which interface must your payment model implement?
-
A
Magento\Framework\Model\AbstractModel
-
B
PaymentMethodInterface
-
C
Magento\Payment\Model\InfoInterface
-
D
Magento\Payment\Model\Method\AbstractMethod
✓ Correct
Explanation
Custom payment methods should extend AbstractMethod, which provides the core functionality and required methods for payment processing including authorize, capture, and refund operations.
You need to create a custom REST API endpoint that accepts POST requests. Which class should you extend to handle this?
-
A
Magento\Framework\Webapi\Rest\Request
-
B
Magento\Framework\Controller\ResultFactory
-
C
Magento\Framework\App\ResourceConnection
-
D
Your custom repository interface with @api annotation
✓ Correct
Explanation
In Adobe Commerce, REST endpoints are generated automatically from repository interfaces marked with @api annotations. The service contract pattern is the standard approach for creating REST API endpoints.
What is the primary purpose of the GraphQL resolvers in Adobe Commerce?
-
A
To cache GraphQL query responses for performance optimization
-
B
To map GraphQL schema fields to data sources and retrieve the requested information
✓ Correct
-
C
To validate input parameters before they reach the database layer
-
D
To authenticate all GraphQL requests using OAuth tokens
Explanation
GraphQL resolvers are responsible for fetching data for each field in the GraphQL schema and returning it in the correct format. They act as the bridge between the schema definition and actual data sources.
When creating a custom attribute for products, which approach allows you to add it programmatically during module installation?
-
A
Creating an XML configuration file in the etc/attributes directory
-
B
Manually editing the eav_attribute table directly with raw SQL
-
C
Using the Magento\Catalog\Setup\ProductSetupFactory in an InstallData script
✓ Correct
-
D
Using the Magento\Catalog\Setup\CategorySetupFactory in an InstallData script
Explanation
ProductSetupFactory provides helper methods to create product attributes programmatically during installation. This is the proper way to add attributes that persist across installations without manual database manipulation.
You are implementing a feature that requires listening to catalog product collection load events. Which observer event should you use?
-
A
catalog_product_load_after
-
B
catalog_product_save_after
-
C
catalog_product_collection_load_before
-
D
catalog_product_collection_loaded
✓ Correct
Explanation
The 'catalog_product_collection_loaded' event fires after a product collection has been fully loaded and all items are populated, making it ideal for post-load processing of multiple products.
In Adobe Commerce, what is the correct way to add a custom column to an existing table using a declarative schema?
-
A
Modify the original table's db_schema.xml directly in the core module
-
B
Create a db_schema_whitelist.json file referencing the new column
-
C
Write an UpgradeSchema script using addColumn() method only
-
D
Add the column definition in your module's db_schema.xml with proper table references
✓ Correct
Explanation
The declarative schema approach uses db_schema.xml files to define database structure. Your module should define the column addition in its own db_schema.xml, which Adobe Commerce merges with other definitions automatically.
What does the @cacheContext annotation do in a GraphQL resolver?
-
A
It specifies which context variables should be used to generate unique cache keys for different user groups or conditions
✓ Correct
-
B
It enables persistent caching of resolver responses in Redis for all users
-
C
It defines the TTL for cached GraphQL query results
-
D
It disables caching for sensitive data in GraphQL responses
Explanation
The @cacheContext annotation tells the caching system which context variations (customer group, store, language, etc.) should create separate cache entries. This ensures users see appropriately cached content.
You need to override a core model class behavior without modifying the original code. Which approach is most appropriate?
-
A
Directly modify the core module files and document your changes
-
B
Create a preference in your module's di.xml pointing to your custom class
✓ Correct
-
C
Use event observers to dispatch to your custom logic instead
-
D
Use a plugin to wrap the original model's methods
Explanation
A preference defined in di.xml is the standard dependency injection approach to override class implementations. It's cleaner than plugins when you need complete class replacement rather than method interception.
When implementing a custom order status, which steps must be completed? Select the scenario that covers all requirements.
-
A
Create a status via admin UI only, and it automatically becomes available for state transitions
-
B
Assign the status to existing states, then assign it to states in the system configuration
✓ Correct
-
C
Define the status in system configuration files and manually insert records into the sales_order_status table
-
D
Use InstallData script to create the status, assign it to states via Sales\Model\Order\Status\History
Explanation
Custom order statuses must be assigned to order states (which are fixed: pending, processing, complete, closed, canceled, held). The status can be created via admin UI then assigned to available states through system configuration.
In a product type plugin, which method determines whether a product can be added to shopping cart?
-
A
isSalable()
✓ Correct
-
B
hasRequiredOptions()
-
C
isComposite()
-
D
canConfigure()
Explanation
The isSalable() method checks if a product is available for purchase and can be added to the cart. It considers stock status and product-specific availability conditions.
You are creating a module that adds a surcharge to orders based on custom logic. Which extension point is most appropriate?
-
A
Custom quote address type in quote_item_abstract
-
B
Observer on sales_order_place_after to modify totals retroactively
-
C
Collector implementing CollectorInterface to add to the quote totals calculation
✓ Correct
-
D
Plugin on OrderRepository::save() to adjust order amounts
Explanation
Total collectors implement the proper extension point for calculating additional charges. They integrate into the quote totals calculation pipeline and ensure proper rendering in checkout and orders.
What is the primary advantage of using service contracts in Adobe Commerce development?
-
A
They eliminate the need for database models completely
-
B
They automatically generate admin UI pages for your functionality
-
C
They automatically handle all caching strategies for your data
-
D
They provide a stable API contract between modules, enabling loose coupling and facilitating WebAPI generation
✓ Correct
Explanation
Service contracts define clear interfaces for module communication. This enables other modules to depend on the interface rather than implementation details, and WebAPI automatically exposes them as REST/SOAP endpoints.
When extending the Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider, which method retrieves data for the UI component?
-
A
fetchData()
-
B
prepareData()
-
C
getData()
✓ Correct
-
D
loadData()
Explanation
The getData() method is called by UI components to retrieve processed data from the data provider. It typically applies filters, sorting, and pagination before returning results.
You need to ensure a customer's email is validated before an order is placed. Where should this validation logic be implemented?
-
A
In a before plugin on Quote::validateMinimumAmount()
-
B
In an observer listening to sales_order_place_before
-
C
In a custom validator class injected into the checkout flow
✓ Correct
-
D
In the customer_save_after observer to pre-validate all customer emails
Explanation
Validators in Adobe Commerce are plugged into the quote validation process and provide structured validation with proper error handling. This is cleaner than observers for checkout validation.
What does the layout merge process do when multiple layout XML files target the same block handle?
-
A
Adobe Commerce combines definitions, with later files overriding earlier ones for same elements
✓ Correct
-
B
Only the first file's definitions are used; later files are ignored
-
C
All files are processed, creating duplicate blocks with unique names
-
D
The system throws an error requiring explicit conflict resolution
Explanation
Layout files are merged in a specific order (based on module load order and sequence). Later definitions override earlier ones, allowing modules to extend and modify layouts defined by other modules.
You are implementing a custom rewrite for product URLs. Which class should handle the URL key generation and persistence?
-
A
A custom repository extending AbstractRepository with rewrite persistence logic
-
B
Magento\Catalog\Model\Product with overridden formatUrlKey() method
-
C
Magento\UrlRewrite\Model\UrlRewrite directly with custom logic
-
D
Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator
✓ Correct
Explanation
ProductUrlRewriteGenerator is the proper class for handling product URL rewrite generation. It manages the creation and persistence of URL rewrites according to category and product changes.
In Adobe Commerce, what is the purpose of the Magento\Framework\Api\SearchCriteriaInterface?
-
A
It defines filter, sort, and pagination parameters for repository search operations
✓ Correct
-
B
It manages database connection pooling for search queries
-
C
It caches search results to improve performance across requests
-
D
It specifies authentication credentials for API requests
Explanation
SearchCriteria is used to pass structured search parameters (filters, sorting, pagination) to repository methods. This standardizes how data retrieval is requested across the application.
You need to create a backend model for a system configuration field that requires custom processing. Which class should you extend?
-
A
Magento\Framework\Model\AbstractModel
-
B
Magento\Framework\Model\Config\Backend\Encrypted
-
C
Magento\Framework\App\Config\Value
✓ Correct
-
D
Magento\Framework\Controller\Result\Json
Explanation
Configuration backend models should extend Value class. This provides hooks for custom validation, serialization, and processing of configuration values before they are saved to the database.
When implementing a custom shipping method, which method calculates the shipping price based on cart contents and destination?
-
A
getRate()
-
B
collectRates() returning RateResultFactory result
✓ Correct
-
C
computeCharges() on the carrier interface
-
D
calculateShippingPrice() in the Rate model
Explanation
The collectRates() method is the core method for shipping carriers. It receives a RateRequest object and returns rate results. The carrier loops through items to calculate appropriate rates.
You want to prevent a specific product attribute from being indexed by the search engine. Which configuration approach should you use?
-
A
Set the attribute's searchable property to false in the attribute definition
✓ Correct
-
B
Add the attribute to the search exclusion list in system configuration
-
C
Mark the attribute with is_searchable = 0 in eav_attribute during creation
-
D
Use a plugin to filter the attribute during indexing in the Indexer class
Explanation
When creating a product attribute, setting searchable to false prevents it from being indexed. This is the declarative approach that integrates properly with the attribute management system.
In the context of Adobe Commerce's module system, what does the sequence declaration in module.xml accomplish?
-
A
It defines the priority for dependency injection when multiple implementations exist
-
B
It determines the order in which modules' setup scripts are executed during installation
-
C
It specifies which modules must be installed before the current module can function
✓ Correct
-
D
It controls the execution order of observers listening to the same event
Explanation
The sequence element in module.xml declares dependencies on other modules. It ensures your module's dependencies are loaded first, preventing issues with missing parent classes, database tables, or configurations.
When creating a custom admin grid using UI components, which XML file defines the columns and their configurations?
-
A
etc/adminhtml/system.xml
-
B
view/adminhtml/ui_component/grid_columns.xml
-
C
view/adminhtml/ui_component/listing.xml
✓ Correct
-
D
view/adminhtml/layout/adminhtml_entity_index.xml
Explanation
UI Component listing grids are defined in XML files in the ui_component directory. These files specify columns, filters, actions, and data sources for the grid interface.
You are implementing a feature that requires access to the current customer's attributes in the frontend. Which approach provides the cleanest implementation?
-
A
Inject CustomerFactory and load the customer by session ID
-
B
Query the customer collection directly with session-based filtering
-
C
Inject Session and access the customer directly without additional queries
✓ Correct
-
D
Inject the SessionManager to get current session customer data
Explanation
The Session object in Adobe Commerce Frontend provides direct access to the current customer without additional database queries. Injecting Session is the recommended approach for accessing customer data.
When extending the quote model to add custom fields, which table should store the additional data while maintaining proper normalization?
-
A
The quote's extension_attributes table if using service contracts
-
B
Additional columns added to the sales_quote table itself
-
C
A dynamic table with the naming pattern sales_quote_[attribute_name]
-
D
A single custom table with foreign key to sales_quote, accessed via a repository
✓ Correct
Explanation
Best practice is to create a separate custom table with a foreign key relationship to sales_quote. This maintains database normalization and allows clean separation of custom data from core data.
You need to create a custom module that extends the product listing functionality. Which configuration file is primarily responsible for declaring module dependencies and setup version?
-
A
events.xml
-
B
di.xml
-
C
config.xml
-
D
module.xml
✓ Correct
Explanation
The module.xml file declares the module name, setup version, and all dependencies required for the module to function properly. This is the entry point for any Adobe Commerce module.
When implementing a custom observer for the 'sales_order_save_after' event, what must you define in your module's events configuration?
-
A
A plugin in di.xml with around method
-
B
Observer class path and method name in events.xml
✓ Correct
-
C
A webhook endpoint in system.xml
-
D
A cron job configuration in crontab.xml
Explanation
Event observers are registered in the events.xml file where you specify the event name, observer instance class, and the method to execute when the event is dispatched.
You are implementing a plugin that modifies the behavior of the getPrice() method in the Product model. The plugin must execute before the original method and potentially prevent its execution. Which plugin type should you use?
-
A
after
-
B
override
-
C
around
✓ Correct
-
D
before
Explanation
An 'around' plugin wraps the original method and can execute code before and after it, as well as prevent the original method from executing. This provides the most control over method behavior.
What is the primary purpose of the ObjectManager in Adobe Commerce, and when should it be used in practice?
-
A
To cache object instances and improve performance; should be used in high-traffic areas
-
B
To instantiate objects and manage their dependencies; should be used everywhere for flexibility
-
C
To create object instances and manage dependencies; should only be used when dependency injection is not feasible
✓ Correct
-
D
To serialize and deserialize objects for database storage; should be used in models only
Explanation
While ObjectManager can instantiate objects, best practice is to use constructor dependency injection. ObjectManager should only be used in exceptional cases where DI cannot be applied, such as in factories or static contexts.
You need to create a custom collection that filters products by a specific attribute. Which class should you extend to maintain compatibility with Adobe Commerce's data handling?
-
A
\Magento\Framework\Model\ResourceModel\Collection\AbstractCollection
-
B
\Magento\Catalog\Model\ResourceModel\Product\Collection
✓ Correct
-
C
\Magento\Framework\Data\Collection
-
D
\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
Explanation
Extending \Magento\Catalog\Model\ResourceModel\Product\Collection provides all necessary product-specific functionality and integrates seamlessly with Adobe Commerce's product management system.
When creating an API endpoint in Adobe Commerce, which file format defines the API structure, parameters, and response types?
-
A
Controller action PHP comments with annotations
-
B
REST configuration in rest.xml
-
C
Web API configuration in webapi.xml
✓ Correct
-
D
OpenAPI/Swagger JSON or YAML specification files
Explanation
The webapi.xml file defines REST and SOAP API routes, HTTP methods, resources, and access permissions for your custom endpoints in Adobe Commerce.
You are debugging a complex data flow issue where a customer's order total is being calculated incorrectly. Which approach would be most efficient for identifying the root cause?
-
A
Enable all logging and search through log files for error messages
-
B
Use a debugger with breakpoints and step through the order total calculation process in the quote model
✓ Correct
-
C
Add var_dump() statements throughout the order calculation logic and reload the page multiple times
-
D
Check the database directly and compare order totals with expected calculations
Explanation
Using a debugger with breakpoints allows you to step through code execution, inspect variables in real-time, and understand the exact flow of data during order total calculation without modifying code.
What is the correct way to add a custom attribute to the customer entity in Adobe Commerce that will be included in REST API responses?
-
A
Add the attribute via InstallData script and manually configure it in system.xml to expose via API
-
B
Use the admin panel to create the attribute and it will automatically appear in API responses
-
C
Create the attribute using InstallData, set the 'used_in_forms' property, and configure it in the extension attributes for the Customer API
✓ Correct
-
D
Modify the Customer model directly and add getCustomAttribute() method
Explanation
Custom customer attributes require creation via migration script, proper configuration in the attribute setup, and extension attributes configuration to be included in REST API responses according to Adobe Commerce standards.
You need to implement a cart rule that applies a discount based on a custom product attribute. Which approach is most maintainable and follows Adobe Commerce best practices?
-
A
Create a custom rule condition class implementing the condition interface and register it in di.xml
✓ Correct
-
B
Modify the cart rule conditions directly in the database and cache the values
-
C
Use a plugin to intercept the quote calculation and manually apply discounts based on attributes
-
D
Write a custom module that observes all product operations and adjusts pricing
Explanation
Creating a custom rule condition class that implements the proper interfaces and registering it in dependency injection is the maintainable, extensible approach that integrates with Adobe Commerce's rule engine.
In Adobe Commerce, what is the purpose of the 'virtual_type' in di.xml configuration, and how does it differ from regular object instantiation?
-
A
Virtual types create shared instances that are reused across requests; they reduce memory overhead significantly
-
B
Virtual types are only used for API responses and have no impact on backend logic
-
C
Virtual types are abstract types that cannot be instantiated directly; they are used as templates for configuring instances with specific arguments
✓ Correct
-
D
Virtual types automatically cache objects in Redis and improve performance in clustered environments
Explanation
Virtual types are non-instantiable configuration templates that allow you to create multiple variations of a class with different constructor arguments without creating separate concrete classes, promoting DRY principles.
Which interceptor type is most appropriate when you need to validate input parameters before a method executes and throw an exception if validation fails?
-
A
after plugin
-
B
override plugin in module config
-
C
before plugin with parameter validation
✓ Correct
-
D
around plugin with early exception throwing
Explanation
A 'before' plugin is ideal for input validation because it executes before the original method and can throw exceptions to prevent invalid operations without needing to wrap the entire method.
You are implementing a payment gateway integration. What must you implement to ensure orders are properly processed through the payment system?
-
A
A custom payment method that extends AbstractMethod and implements the authorize/capture flow
✓ Correct
-
B
An observer that listens to order events and makes direct API calls to the payment provider
-
C
A simple HTTP client to communicate with the gateway and a cron job to sync payments
-
D
A custom quote extension that stores payment tokens directly
Explanation
Payment methods must extend the AbstractMethod class and implement the required methods (authorize, capture, etc.) to integrate properly with Adobe Commerce's payment processing architecture.
When you need to persist data that doesn't fit into standard database tables, what is the recommended approach in Adobe Commerce?
-
A
Serialize data and store it in product attributes regardless of the data type
-
B
Use the session storage mechanism to persist data across requests
-
C
Store the data in the core_config_data table with a custom prefix
-
D
Create a custom table via module InstallSchema script and a corresponding model/resource model
✓ Correct
Explanation
Creating custom database tables with proper model and resource model classes is the recommended approach for handling custom data that requires persistent storage beyond the standard Adobe Commerce tables.
What is the role of the 'layout' XML file in Adobe Commerce, and where should you define custom blocks?
-
A
Layout files are only for styling and CSS; blocks must be defined only in controller actions
-
B
Layout files define routes and controllers; blocks are defined in view models
-
C
Layout files manage translations; blocks are registered in system.xml configuration
-
D
Layout files define page structure and can be modified in theme or module XML files; custom blocks are defined in layout handles
✓ Correct
Explanation
Layout XML files (typically in view/layout directories) define page structure, block instances, and their arrangement. Custom blocks can be declared and configured within layout handles for specific pages or actions.
You need to add a new step to the customer checkout process. Which configuration file allows you to define custom checkout steps and their dependencies?
-
A
checkout.xml in system configuration
-
B
routes.xml in the module configuration
-
C
checkout_index_index.xml layout file with custom step definitions
✓ Correct
-
D
layout.xml for the checkout module
Explanation
The checkout_index_index.xml layout file (or similarly named checkout layout) contains the checkout page structure where you can add custom steps using the checkout step component configuration.
When implementing a custom import mechanism for bulk product data, which approach ensures data integrity and proper indexing?
-
A
Loop through products and use model->save() for each item, then manually trigger indexing
-
B
Use REST API endpoints to create products in batches with manual error handling
-
C
Write raw SQL INSERT statements for performance and schedule a reindex cron
-
D
Use Adobe Commerce's Import/Export framework with a custom import source and let the system handle indexing automatically
✓ Correct
Explanation
Adobe Commerce's Import/Export framework handles validation, indexing, and data consistency automatically. Custom import sources integrate seamlessly while maintaining system integrity.
In a multi-website setup, how should you handle store-specific configuration values that must be accessible in your custom code?
-
A
Store all values in a static array in your module's helper class on first access
-
B
Read values directly from core_config_data table using SQL queries filtered by store_id
-
C
Use the ScopeConfigInterface to retrieve configuration values with proper scope resolution (global, website, store)
✓ Correct
-
D
Read environment variables that correspond to each store's configuration
Explanation
ScopeConfigInterface is the proper abstraction for accessing configuration values with correct scope hierarchy. It handles fallback logic and respects multi-store, multi-website setups automatically.
What is the purpose of GraphQL in Adobe Commerce, and how does it differ from REST API architecture?
-
A
GraphQL is deprecated in favor of REST; REST provides all functionality needed for modern applications
-
B
GraphQL allows clients to request exactly the data they need, reducing payload size; REST returns fixed data structures for each endpoint
✓ Correct
-
C
They are identical in functionality; GraphQL is just a newer naming convention for REST
-
D
GraphQL is only for admin operations; REST is for storefront customers
Explanation
GraphQL enables clients to specify precisely which fields they need, reducing over-fetching and under-fetching problems inherent in REST's fixed response structures, making it more efficient for diverse client needs.
You need to create a custom GraphQL query that returns a list of products filtered by a custom attribute. Which file should you use to define the GraphQL schema?
-
A
A schema.graphqls file in the module's view/graphql directory
✓ Correct
-
B
graphql.xml in the module's etc directory
-
C
A REST configuration file that automatically translates to GraphQL
-
D
PHP configuration in di.xml with GraphQLType definitions
Explanation
GraphQL schemas are defined in .graphqls files using GraphQL Schema Definition Language. These files are typically located in view/graphql directories and are processed by Adobe Commerce's GraphQL engine.
When you need to execute code after a successful order placement, which event should you observe, and why is it preferable to using a plugin?
-
A
checkout_submit_all_after event because it fires before order persistence
-
B
sales_order_place_after event because it's guaranteed to fire after all order processing is complete and persisted
✓ Correct
-
C
sales_model_service_quote_submit_success which only fires for specific quote types
-
D
payment_method_post_process which handles all payment scenarios universally
Explanation
The sales_order_place_after event fires after all order data is persisted to the database, making it ideal for post-order operations. Plugins on save methods may execute before persistence is complete.
What is the correct way to extend the product model with additional functionality while maintaining backward compatibility?
-
A
Use observers to listen to all product events and add functionality externally
-
B
Create a plugin that intercepts product model methods and adds custom logic
✓ Correct
-
C
Modify the Product model class directly and override required methods
-
D
Create a custom model that extends Product and replace it via di.xml preferences
Explanation
Plugins (interceptors) allow you to extend functionality without modifying original classes, maintaining backward compatibility and allowing multiple extensions to coexist without conflicts.
You are implementing a feature that requires calculating product prices based on customer group, special offers, and catalog rules. Where should this logic be placed for optimal performance and maintainability?
-
A
In a custom plugin that intercepts the getPrice() method on every call
-
B
In the price index table through a custom index source to pre-calculate prices
✓ Correct
-
C
In the template files where products are displayed to calculate on-the-fly
-
D
In an observer that listens to product view events and modifies price display
Explanation
Using a custom price index source pre-calculates prices and stores them in the index table, providing optimal query performance compared to real-time calculation on every price retrieval.
In Adobe Commerce, what is the purpose of preferences in di.xml, and how do they affect class instantiation throughout the system?
-
A
Preferences redirect interface/class dependencies to alternative implementations globally without modifying all files that use them
✓ Correct
-
B
Preferences define default values for constructor parameters and improve code readability
-
C
Preferences specify which version of a module should be loaded when conflicts exist
-
D
Preferences configure caching behavior for object instances created by the ObjectManager
Explanation
Preferences allow you to substitute one class implementation for another globally. When code requests an interface or base class, the system automatically provides the preferred implementation instead.
You need to add a custom column to the sales_order table that stores additional order metadata. Which approach ensures your modification is maintainable and upgradeable?
-
A
Create an InstallSchema script in your module that adds the column via SchemaSetupInterface
✓ Correct
-
B
Modify the core sales module's InstallSchema file directly
-
C
Write raw SQL ALTER TABLE statements in a setup script
-
D
Use the order's extension attributes to store metadata without modifying database schema
Explanation
Using InstallSchema with SchemaSetupInterface ensures your database modifications are properly versioned, upgradeable, and follow Adobe Commerce's schema management conventions.
When developing a custom module that interacts with the inventory system, what must you consider regarding product stock synchronization in multi-source environments?
-
A
Stock updates in one source automatically propagate to all sources without additional configuration
-
B
You must use the MSI (Multi-Source Inventory) APIs and understand sources, stocks, and salable quantities for proper inventory management
✓ Correct
-
C
The inventory system operates independently of product attributes and requires no integration logic
-
D
Stock synchronization happens automatically; you only need to update the simple cataloginventory_stock_item table
Explanation
Adobe Commerce's MSI system involves sources, stocks, and salable quantities that must be properly managed through dedicated APIs. Updates to one source don't automatically affect others; proper API usage is essential.
When implementing a custom observer in Adobe Commerce, which event fires after a product is saved to the database?
-
A
catalog_product_update_after
-
B
catalog_product_save_commit_after
-
C
catalog_product_save_before
-
D
catalog_product_save_after
✓ Correct
Explanation
The catalog_product_save_after event fires immediately after a product entity is saved. The _commit_after variant fires after the transaction is committed, making it suitable for operations that depend on database persistence.
In Adobe Commerce, what is the primary purpose of the var/generation directory?
-
A
Store dynamically generated interceptor and factory classes
✓ Correct
-
B
Store static assets and media file references
-
C
Store temporary session files and cache data
-
D
Store compiled translation files and language packs
Explanation
The var/generation directory contains auto-generated code including interceptors, factories, and proxies that are created during compilation. This directory is essential for the dependency injection mechanism.
Which of the following XML nodes is required to define a new admin menu item in Adobe Commerce?
-
A
adminhtml/menu/add
-
B
config/adminhtml/menu/item
✓ Correct
-
C
system/adminhtml/menu/item
-
D
menu/root/item
Explanation
Admin menu items are defined in the adminhtml section using the menu node structure. The config/adminhtml/menu path is the correct XML structure for adding menu items to the admin panel.
When creating a custom quote extension attribute in Adobe Commerce, which interface must be extended to ensure proper quote management?
-
A
Magento\Framework\Api\ExtensionAttributesInterface
-
B
Magento\Quote\Api\ExtensionAttributesInterface
-
C
Magento\Quote\Model\Quote\Extension\AbstractExtension
-
D
Magento\Quote\Api\Data\CartInterface
✓ Correct
Explanation
Extension attributes are defined through the extension_attributes.xml file targeting CartInterface. The AbstractExtension class is auto-generated, but the correct interface to target is CartInterface for quote-related extensions.
What is the correct way to retrieve a customer by email address using the customer repository in Adobe Commerce?
-
A
$this->customerRepository->getById($customerId);
-
B
$this->customerFactory->create()->loadByEmail($email);
✓ Correct
-
C
$this->customerRepository->getByEmail($email);
-
D
$this->customerRepository->get($email);
Explanation
The CustomerRepository doesn't have a getByEmail method. The correct approach is to use the CustomerFactory to create a customer instance and call loadByEmail(), or use a search criteria with the repository's getList() method.
In Adobe Commerce, what does the di.xml file primarily configure?
-
A
API endpoint routing and REST controller mapping
-
B
Database connection parameters and schema definitions
-
C
Dependency injection, virtual types, and class preferences
✓ Correct
-
D
Event observer definitions and plugin execution order
Explanation
The di.xml (dependency injection) file defines how objects are instantiated, configured with constructor arguments, and manages virtual types and class preferences throughout the application.
Which command is used to regenerate static files in Adobe Commerce production mode?
-
A
bin/magento cache:clean && bin/magento assets:deploy
-
B
bin/magento dev:static:deploy
-
C
bin/magento static:deploy
-
D
bin/magento setup:static-content:deploy
✓ Correct
Explanation
The setup:static-content:deploy command is the correct command for generating static files in Adobe Commerce. It processes CSS, JavaScript, and images for specified locales and themes.
When implementing a plugin (interceptor) on a public method, which plugin type allows you to modify the method result before it is returned?
-
A
override plugin
-
B
after plugin
✓ Correct
-
C
around plugin
-
D
before plugin
Explanation
An after plugin executes after the original method and can modify the result before returning it. An around plugin has more control but after plugins are specifically designed for result modification.
What is the purpose of the module's registration.php file in Adobe Commerce?
-
A
Define database table structures and migrations
-
B
Configure ACL resources and admin permissions
-
C
Register the module with the application and specify its setup version
✓ Correct
-
D
Map URL routes to controller actions
Explanation
The registration.php file uses the ComponentRegistrar to register a module, specifying its name, type (module), and path. This file is essential for Adobe Commerce to recognize and load the module.
In Adobe Commerce, which class is responsible for formatting prices according to store locale and currency settings?
-
A
Magento\Framework\Pricing\Render\PriceBox
-
B
Magento\Framework\Locale\Format
-
C
Magento\Framework\Pricing\PriceCurrencyInterface
✓ Correct
-
D
Magento\Framework\Currency
Explanation
The PriceCurrencyInterface handles price formatting based on locale and currency. It provides methods like format() to convert prices with proper currency symbols and locale-specific formatting.
What does the system:setup:inlined:dynamic-content command do in Adobe Commerce?
-
A
This command does not exist in standard Adobe Commerce
✓ Correct
-
B
Inlines critical CSS for faster page rendering
-
C
Compiles LESS stylesheets into CSS files
-
D
Generates dynamic content caching rules
Explanation
There is no system:setup:inlined:dynamic-content command in Adobe Commerce. This is a distractor. Actual commands include setup:static-content:deploy and setup:di:compile.
When creating a custom data model in Adobe Commerce, which interface must be implemented to make the data accessible via API?
-
A
Magento\Framework\Model\ResourceModel\Db\AbstractDb
-
B
Magento\Framework\Model\AbstractModel
-
C
Magento\Framework\Api\ExtensibleDataInterface
✓ Correct
-
D
Magento\Framework\Data\CollectionFactory
Explanation
Implementing ExtensibleDataInterface allows a data model to be used as an API data object with support for custom and extension attributes. This is required for proper API integration.
What is the correct way to add a new attribute to an existing customer EAV table in Adobe Commerce?
-
A
Directly insert into the database using SQL in a custom module
-
B
Modify the customer entity configuration in system.xml
-
C
Use the Magento\Framework\Setup\ModuleDataSetupInterface in a data migration script
-
D
Use the Magento\Customer\Setup\CustomerSetup class in an InstallData script
✓ Correct
Explanation
The CustomerSetup class provides the createAttribute() method, which is the proper way to add customer attributes. This ensures the attribute is properly registered in the system and is accessible throughout Adobe Commerce.
In Adobe Commerce, what does the layout XML node <block type='...'/> accomplish?
-
A
Defines a CSS class and styling rules for a section
-
B
Renders HTML output directly without block processing
-
C
Creates an instance of a block class and adds it to the layout structure
✓ Correct
-
D
Configures caching rules for a specific page section
Explanation
The block node instantiates a block class and places it in the layout hierarchy. The type attribute specifies the block class, and child elements can configure properties and child blocks.
Which method on the ProductRepository ensures that product data is loaded with all necessary attributes for storefront display?
-
A
get() with a specific SKU and optional store context
✓ Correct
-
B
loadAttributes() followed by getSelf()
-
C
getFullProductData() with store ID parameter
-
D
getById() with all attributes automatically loaded
Explanation
The ProductRepository's get() method accepts a SKU and optional store ID. It loads the product with all attributes necessary for that store view. The getById() method requires a numeric ID, not a SKU.
What is the purpose of the <argument> tag within a block definition in layout XML?
-
A
Define URL parameters and query string values
-
B
Configure database query filters and conditions
-
C
Specify form field validation rules
-
D
Pass constructor arguments to the block class
✓ Correct
Explanation
The <argument> tag within a block passes data to the block's constructor via the _data parameter. Arguments can be scalars, objects, or arrays and are essential for block configuration.
In Adobe Commerce, which file defines the structure and relationships of your module's database tables?
-
A
etc/db_structure.xml
-
B
db_schema.xml
✓ Correct
-
C
Setup/InstallSchema.php
-
D
sql/setup_version/schema.php
Explanation
The db_schema.xml file is the modern declarative schema definition for Adobe Commerce modules. It replaces the need for InstallSchema and UpgradeSchema classes for schema management.
What does the Magento\Framework\App\Config\ScopeConfigInterface::getValue() method return when called with a non-existent configuration path?
-
A
False
-
B
null
✓ Correct
-
C
An empty string
-
D
An exception is thrown
Explanation
The getValue() method returns null when a configuration path does not exist. This allows safe checking of configuration values without exception handling.
When implementing a custom shipping method in Adobe Commerce, which interface must the carrier model implement?
-
A
Magento\Shipping\Model\Carrier\AbstractCarrier
-
B
Magento\Shipping\Model\Carrier\CarrierInterface
✓ Correct
-
C
Magento\Framework\Model\ResourceModel\AbstractResource
-
D
Magento\Quote\Model\ShippingMethodInterface
Explanation
Custom shipping carriers must implement CarrierInterface, which defines methods like collectRates() and getAllowedMethods(). Extending AbstractCarrier provides a base implementation of this interface.
In Adobe Commerce, what is the correct way to log messages for debugging purposes?
-
A
Use error_log() PHP function directly
-
B
Write directly to var/log/system.log using file operations
-
C
Inject Psr\Log\LoggerInterface and call methods like info(), error(), or debug()
✓ Correct
-
D
Use the Magento\Framework\Logger class static methods
Explanation
Adobe Commerce uses PSR-3 logging via LoggerInterface dependency injection. This integrates with the framework's logging system and respects configured log levels and handlers.
What is the purpose of the module's view.xml file?
-
A
Define default store configuration and system settings
-
B
Map template files to their corresponding block classes
-
C
Configure frontend CSS and JavaScript file inclusions
-
D
Specify theme images and their responsive breakpoints
✓ Correct
Explanation
The view.xml file defines theme images, including alternate sizes and responsive versions. It specifies attributes like width, height, and corresponding media queries for responsive design.
In Adobe Commerce, which class method is used to add an error message to the customer session that persists across redirects?
-
A
$this->messageManager->addError('message');
✓ Correct
-
B
$this->customerSession->addFlashError('message');
-
C
$this->session->setErrorMessage('message');
-
D
$this->resultFactory->create()->setError('message');
Explanation
The MessageManager service (injected via constructor) is the proper way to add messages that persist through redirects. The addError() method adds an error message to the queue.
What is the difference between $product->getData('attribute_code') and $product->getAttributeCode() in Adobe Commerce?
-
A
They are identical; both methods retrieve the same attribute value
-
B
getData() uses camelCase attribute names while getAttributeCode() uses underscore notation
-
C
getAttributeCode() only works for system attributes; getData() works for all attributes
-
D
getData() returns raw database values while getAttributeCode() returns formatted values
✓ Correct
Explanation
getData() retrieves raw values directly from the model's data array, while magic getters like getAttributeCode() may apply formatting, type casting, or retrieve related data. Magic getters are more convenient for standard attributes.
In Adobe Commerce GraphQL, which argument is used to sort query results by a specific field?
-
A
pagination: {...}
-
B
sort: {...}
✓ Correct
-
C
order_by: {...}
-
D
filter: {...}
Explanation
GraphQL queries use the sort argument to specify field sorting with ASC or DESC direction. The filter argument handles value filtering, while pagination controls result limits and offsets.
What does the file app/code/[Vendor]/[Module]/Model/ResourceModel/[Entity]/Collection.php represent in Adobe Commerce?
-
A
A cache manager for storing query results
-
B
A data transfer object for API responses
-
C
A collection class for querying multiple entity records from the database
✓ Correct
-
D
A service class for business logic operations
Explanation
The Collection class extends AbstractCollection and provides methods to query multiple records, apply filters, sorting, and pagination. It uses the ResourceModel to interact with the database.
In Adobe Commerce, when should you use a virtual type instead of creating a new class?
-
A
When you need to create temporary objects that are garbage collected immediately
-
B
When you want to bypass dependency injection and instantiate objects manually
-
C
When a class requires multiple inheritance that PHP doesn't support
-
D
When you need to create a class that doesn't physically exist but shares configuration with an existing class
✓ Correct
Explanation
Virtual types allow you to define different configurations of the same class without creating actual new classes. This is useful for factories, argument processors, or other specialized instances of a base class.
When implementing a custom payment method in Adobe Commerce, which interface must your payment model implement to handle authorization?
-
A
\Magento\Payment\Api\PaymentMethodManagementInterface
-
B
\Magento\Payment\Model\MethodInterface
✓ Correct
-
C
\Magento\Payment\Observer\AbstractObserver
-
D
\Magento\Payment\Model\Method\AbstractMethod
Explanation
The MethodInterface defines the contract for payment methods including authorization handling. AbstractMethod is a base class but doesn't enforce the interface contract required by the payment system.
What is the correct way to add a custom attribute to the customer address entity programmatically in Adobe Commerce?
-
A
Use the EAV table structure directly with INSERT statements in a data migration
-
B
Modify the customer_address table schema in the database module
-
C
Create an InstallData script using the EAV setup and addAttribute method
✓ Correct
-
D
Add the attribute through the admin panel and export the configuration as code
Explanation
InstallData scripts with the EAV setup are the proper programmatic way to add custom attributes to entities like customer addresses. This approach ensures proper installation and upgrades.
In Adobe Commerce, how should you persist data to a custom table that is not part of the standard EAV structure?
-
A
Create a custom model extending \Magento\Framework\Model\ResourceModel\Db\AbstractDb
✓ Correct
-
B
Use direct PDO connections to bypass the ORM layer for performance
-
C
Store all data in the catalog_product_entity_varchar table with a custom attribute code
-
D
Implement a custom repository pattern directly calling raw SQL queries
Explanation
AbstractDb is the correct base class for custom resource models that handle non-EAV table persistence. It provides proper abstraction, transaction handling, and integration with Adobe Commerce's database layer.
Which observer event would you use to modify product data immediately before it is saved to the database?
-
A
model_save_before
-
B
catalog_product_validate
-
C
catalog_product_prepare_save
✓ Correct
-
D
catalog_product_save_before
Explanation
The catalog_product_prepare_save event fires after validation but before the actual save, making it ideal for final modifications. The save_before event fires even earlier, before preparation.
What is the primary purpose of using a plugin (interceptor) instead of an observer in Adobe Commerce?
-
A
Observers are faster and should always be preferred for performance-critical code
-
B
Plugins can access protected methods while observers can only access public methods
-
C
Observers are deprecated and should not be used in new code
-
D
Plugins provide synchronous execution control and allow return value modification, while observers are asynchronous event handlers
✓ Correct
Explanation
Plugins allow you to modify method behavior and return values synchronously through before/after/around interceptors, while observers handle events asynchronously and cannot modify return values. Both remain relevant.
In a complex inheritance scenario, how does Adobe Commerce's plugin execution order work when multiple plugins target the same method?
-
A
Around plugins execute in a nested manner based on their sortOrder, with around plugins wrapping before/after plugins
✓ Correct
-
B
Plugin execution order is non-deterministic and should not be relied upon for critical business logic
-
C
Plugins execute in the order they are declared in di.xml, with earlier declarations executing first
-
D
All before plugins execute, then the original method, then all after plugins, respecting sortOrder across all types
Explanation
Around plugins create a nested execution chain, allowing each to control call flow. The sortOrder attribute in di.xml determines the execution sequence for plugins of the same type on the same method.
How should you implement virtual types in Adobe Commerce when you need multiple instances of a class with different configurations?
-
A
Define them in di.xml using the virtualType tag with arguments for each configuration variant
✓ Correct
-
B
Use factory pattern by implementing a custom factory class that returns configured instances
-
C
Store configuration in database and use a singleton pattern with runtime configuration loading
-
D
Create separate model classes extending the base class for each configuration needed
Explanation
Virtual types in di.xml allow you to create multiple configured instances without writing separate classes. This is cleaner than subclassing and more maintainable than factory implementations.
What is the correct approach to handle database migrations in Adobe Commerce modules when you need to add a new table?
-
A
Use the database schema XML configuration in the module root directory
-
B
Write raw SQL in the module's Setup directory and execute it during module installation
-
C
Create InstallSchema.php for initial installation and UpgradeSchema.php for version changes
✓ Correct
-
D
Create migrations in a dedicated migrations folder using a custom migration handler
Explanation
InstallSchema handles the initial table creation, while UpgradeSchema manages schema changes between module versions. This provides proper versioning and rollback capability.
When dealing with quote and order data in Adobe Commerce, which service class should you use to properly convert a quote to an order while ensuring all extensions and plugins are executed?
-
A
Direct instantiation of Order model and setting quote data as array
-
B
\Magento\Quote\Model\QuoteManagement::placeOrder
✓ Correct
-
C
SQL INSERT statement copying quote data to sales_order table
-
D
\Magento\Sales\Model\OrderFactory and manual data transfer
Explanation
QuoteManagement::placeOrder is the proper service that ensures all necessary processing, plugin execution, and event dispatching occur during order creation. Direct approaches bypass critical business logic.
How does Adobe Commerce handle concurrent requests when modifying the same product inventory? Which mechanism prevents race conditions?
-
A
Optimistic locking using version numbers or timestamps in the product entity
-
B
A combination of database transactions and the inventory reservation system in Adobe Commerce
✓ Correct
-
C
Database row-level locks acquired through pessimistic locking in the resource model
-
D
In-memory locks using Redis to serialize all product modifications
Explanation
Adobe Commerce uses database transactions combined with the inventory reservation system (especially in version 2.3+) to handle concurrent inventory modifications safely. This replaces the older simple stock system.
Which GraphQL query structure would you use to retrieve customer order data with applied discount information in Adobe Commerce?
-
A
Use the ordersQuery with nested selection of discount_items and adjustments fields
-
B
Query customer data first, then make separate REST API calls for each order's discount information
-
C
Query with customerOrders resolver, selecting orders edge with discounts field and total calculation
✓ Correct
-
D
Direct query on sales_order table using GraphQL custom resolver without permission checks
Explanation
The customerOrders resolver provides the proper GraphQL structure with authorization checks and allows selection of discounts through nested fields. This maintains security and uses proper GraphQL conventions.
In Adobe Commerce, what is the difference between using a SearchCriteria filter and using direct collection methods when querying products?
-
A
SearchCriteria uses the Service Contracts/Repository pattern providing abstraction and backend flexibility, while collections are direct database queries
✓ Correct
-
B
Collections are always faster and should be preferred unless the SearchCriteria API is required by external systems
-
C
There is no difference; they execute identical SQL queries
-
D
SearchCriteria is deprecated in favor of using Elasticsearch directly for all product queries
Explanation
SearchCriteria through repositories follows Service Contracts, allowing backend implementations to change (e.g., from MySQL to Elasticsearch) without breaking client code. Collections are direct database access with less flexibility.
How should you implement a custom console command in Adobe Commerce to perform batch operations on products?
-
A
Write a PHP script in the root directory and call it from a cron job configuration
-
B
Use the Magento\Shell\Command class with raw PHP execution in the bin/magento script
-
C
Implement the command directly in the module's observer listening to cron_schedule events
-
D
Create a class in Console/Command extending \Symfony\Component\Console\Command\Command in your module's directory
✓ Correct
Explanation
Extending Symfony's Command class in the Console/Command directory is the proper way to create CLI commands integrated with the Magento CLI infrastructure. This provides dependency injection and proper command registration.
What is the correct way to implement a custom checkout step in Adobe Commerce that integrates with the existing checkout flow without breaking extensions?
-
A
Add a new step layout handle, create block and template files, and use checkout_index_index.xml to include your step in the checkout layout
✓ Correct
-
B
Modify the checkout template directly in the theme and add JavaScript to handle your custom logic
-
C
Replace the entire checkout module with your custom implementation to ensure your step loads first
-
D
Use a frontend controller redirect to your custom page between existing checkout steps
Explanation
Using layout handles and XML configuration allows your custom step to integrate properly with the layout system and respects the modular architecture. Direct template modification breaks with theme updates and other extensions.
In Adobe Commerce, how does the framework resolve dependencies when a class requires multiple implementations of the same interface?
-
A
Using named instances and specifying the preferred instance name in the class constructor definition within di.xml
✓ Correct
-
B
Throwing an exception requiring manual specification of which implementation to inject
-
C
By automatically selecting the last registered implementation in alphabetical order
-
D
Loading all implementations into an array and letting the class iterate through them
Explanation
Named instances in di.xml allow specifying which concrete implementation should be injected for a given interface. This provides explicit control over dependency resolution when multiple implementations exist.
What is the primary advantage of using the Repository pattern in Adobe Commerce when creating a custom entity data model?
-
A
It provides built-in encryption for all stored data attributes
-
B
It automatically caches all queries in Redis, improving performance significantly
-
C
It eliminates the need for database migrations since data can be stored anywhere
-
D
It decouples business logic from persistence details, allowing persistence layer changes without affecting consuming code
✓ Correct
Explanation
The Repository pattern creates abstraction between business logic and data persistence, allowing you to change storage mechanisms (database, files, APIs) without modifying dependent code. This follows SOLID principles.
How should you extend the customer registration form in Adobe Commerce to add custom attributes without modifying core files?
-
A
Create a plugin on the registration controller to intercept and modify form data
-
B
Use JavaScript to inject form fields dynamically on page load without server-side integration
-
C
Directly edit the Magento_Customer module templates in your theme override
-
D
Create a custom attribute using customer_setup, then use a layout update XML file to add the field to the registration form
✓ Correct
Explanation
Creating attributes through setup scripts and then adding form elements via layout XML is the proper extensible approach. This respects the module system and survives updates.
In Adobe Commerce, what is the role of the app/etc/di.xml file and how does module-level di.xml interact with it?
-
A
Module-level di.xml files are ignored; all dependencies must be defined in the global app/etc/di.xml
-
B
The global di.xml defines framework configurations, while module di.xml files override and extend it with module-specific definitions
✓ Correct
-
C
The global di.xml is only used for theoretical configuration; actual dependencies are loaded from the database
-
D
Module di.xml files completely replace app/etc/di.xml definitions to prevent conflicts
Explanation
The framework loads app/etc/di.xml first to establish core configurations, then merges module-level di.xml files in sequence. Module definitions can override or extend the global configuration.
How does Adobe Commerce handle sensitive data like credit card information in the checkout process to maintain PCI compliance?
-
A
Credit card data never touches the server; tokenization and hosted payment forms transmit directly to payment processors
✓ Correct
-
B
Magento automatically handles all PCI compliance through built-in encryption protocols
-
C
All credit card data is encrypted with AES-256 and stored in the local database with proper access controls
-
D
Payment data is stored in plain text but access is restricted through role-based permissions
Explanation
PCI compliance requires that credit card data never reaches your servers. Adobe Commerce uses payment tokenization and hosted payment forms so payment processors handle the sensitive data directly.
What is the correct approach to implement custom business logic that should execute after an order is placed but before the order confirmation email is sent?
-
A
Use the sales_order_place_after event to perform logic, which executes before email sending hooks
✓ Correct
-
B
Implement a cron job that processes orders every minute to apply post-placement logic
-
C
Use an observer on the email_transport_send_before event to modify order state before sending
-
D
Create a plugin on the EmailNotificationInterface send method to intercept before email dispatch
Explanation
The sales_order_place_after event fires after order creation but before email notifications, making it ideal for post-placement business logic. Other approaches either execute at wrong times or are less reliable.
In Adobe Commerce, how should you implement pagination and filtering for a custom admin grid displaying extension data?
-
A
Store grid configuration in the database and load it through a custom renderer in the admin layout
-
B
Create an XML grid definition with columns, use a collection as the data provider, and implement FilterInterface in your collection
✓ Correct
-
C
Implement a custom grid class directly using HTML table elements and JavaScript without following Magento patterns
-
D
Use DataTable jQuery plugin with manual AJAX calls to fetch and filter data from a custom controller endpoint
Explanation
XML grid definitions with collection data providers following Magento patterns provide proper pagination, filtering, and sorting integration. This maintains consistency with the admin UI and respects ACLs.
What is the significance of the ObjectManager in Adobe Commerce, and when should you use it versus dependency injection?
-
A
ObjectManager and DI are equivalent; use whichever is more convenient for your situation
-
B
ObjectManager is the recommended way to instantiate classes because it handles all Magento specifics automatically
-
C
Dependency injection via constructor is preferred; ObjectManager should only be used in factories and when DI is impossible
✓ Correct
-
D
ObjectManager is deprecated and should never be used in modern Adobe Commerce development
Explanation
Dependency injection through constructors is the best practice for loose coupling and testability. ObjectManager should only be used in factories and special cases where DI isn't feasible.
How does Adobe Commerce handle URL rewriting for custom entities, and what database tables are involved in the process?
-
A
URL rewriting is handled entirely through htaccess rules without database involvement for better performance
-
B
URLs are generated dynamically on each request by computing paths from entity attributes without any caching
-
C
The url_rewrite table stores mappings between request paths and target paths with entity type and ID, used by the router during request processing
✓ Correct
-
D
Each entity type maintains its own separate URL table; there is no centralized url_rewrite table
Explanation
The url_rewrite table is central to Adobe Commerce's routing system, storing relationships between URLs and entities. The router queries this table to resolve incoming requests to the correct entity.
When implementing a custom shipping method, what is the correct way to validate shipping address data and return appropriate error messages?
-
A
Use direct validation in JavaScript before the shipping method is even offered as an option
-
B
Throw an exception from the shipping method which is automatically caught and displayed to the customer
-
C
Implement validation in a custom module observer that prevents order placement if address is invalid
-
D
Return false from isActive() method if address is invalid, or use Carrier interface collectRates() to return error message object
✓ Correct
Explanation
The Carrier interface's collectRates() method returns Error objects for invalid conditions, while isActive() can prevent method display. Exceptions and JavaScript validation don't provide proper integration with the shipping system.
In Adobe Commerce, what is the difference between using app/code and vendor directories for module installation, and when would you use each?
-
A
app/code is for custom project modules and extensions, while vendor is for Composer-managed third-party packages; use app/code for custom development
✓ Correct
-
B
vendor directory should always be used; app/code is legacy and unsupported
-
C
Both are identical in functionality; choose based on personal preference
-
D
app/code is for production code while vendor is only for development dependencies
Explanation
Custom and proprietary modules go in app/code for version control, while third-party and open-source packages managed by Composer go in vendor. This maintains separation of concerns and follows best practices.
How should you implement a recurring/subscription product type in Adobe Commerce that properly integrates with the order and invoicing system?
-
A
Create a custom product type extending \Magento\Catalog\Model\Product\Type\AbstractType and implement billing cycle logic in sales_order_place_after observer
✓ Correct
-
B
Extend the bundle product type to group regular products into subscription packages with custom pricing
-
C
Use a simple product type with a custom attribute for billing frequency and implement invoicing logic in a separate cron job module
-
D
Create a custom table to track subscriptions and implement all invoicing logic outside the standard order system
Explanation
Custom product types extending AbstractType provide proper integration with the catalog and sales systems. Implementing billing cycle logic in observers ensures proper event flow and plugin execution.
What is the recommended way to handle API rate limiting and throttling in Adobe Commerce for REST API endpoints?
-
A
Configure rate limiting directly in the web server (Nginx/Apache) configuration files
-
B
Use GraphQL instead of REST because it inherently prevents rate limit abuse
-
C
Implement a custom Middleware/Interceptor checking request frequency against customer ID stored in a rate limit table with TTL cache
✓ Correct
-
D
Implement rate limiting in JavaScript on the client side to prevent excessive requests
Explanation
Custom middleware or plugins checking rate limits per customer against cached counters is the proper application-level approach. Web server configuration is complementary but not sufficient for API-specific logic.
When implementing a custom payment integration in Adobe Commerce, which interface must your payment method class implement to handle transaction authorization?
-
A
\Magento\Payment\Model\InfoInterface
-
B
\Magento\Payment\Model\PaymentMethodInterface
-
C
\Magento\Payment\Api\PaymentMethodInterface
-
D
\Magento\Payment\Model\MethodInterface
✓ Correct
Explanation
MethodInterface is the required interface for custom payment methods in Adobe Commerce, providing the contract for payment processing operations including authorization and capture.
In Adobe Commerce, what is the primary purpose of the GraphQL resolver pattern when building custom queries?
-
A
To cache all GraphQL responses automatically
-
B
To validate GraphQL schema definitions against the database structure
-
C
To resolve GraphQL field data by executing business logic and fetching required information
✓ Correct
-
D
To convert database queries into REST endpoints
Explanation
Resolvers in GraphQL are functions that execute business logic to fetch and return data for specific fields, enabling the GraphQL layer to retrieve information from various sources.
Which Adobe Commerce module provides the framework for managing customer attributes and custom attribute sets?
-
A
Magento_Catalog
-
B
Magento_Customer
-
C
Magento_Attribute
-
D
Magento_Eav
✓ Correct
Explanation
The Magento_Eav (Entity-Attribute-Value) module provides the foundational framework for managing extensible attributes across multiple entities including customers, products, and orders.
When creating a custom observer for the 'sales_order_place_after' event, at what point in the order lifecycle does this event fire?
-
A
During the quote-to-order conversion process before any payment processing
-
B
After the order object has been saved to the database following successful checkout
✓ Correct
-
C
Immediately after payment authorization but before order confirmation
-
D
When the customer clicks the place order button but before validation occurs
Explanation
The sales_order_place_after event is dispatched after the order has been successfully created and persisted to the database, making it ideal for post-order processing tasks.
In Adobe Commerce, what is the correct way to add a custom column to an existing database table using a declarative schema?
-
A
Add the column definition to db_schema.xml under the table element and increment db_schema_whitelist.json
✓ Correct
-
B
Create a new db_schema.xml file with only the column definition and use addColumn() in a setup script
-
C
Use InstallSchema.php to execute raw SQL ALTER TABLE statements directly
-
D
Modify the original table XML definition in the module's etc/db_schema.xml file and increment the schema version
Explanation
Declarative schema uses db_schema.xml to define all table structures, and the db_schema_whitelist.json must be updated to track schema changes, allowing Adobe Commerce to manage migrations properly.
What is the primary benefit of using Adobe Commerce's Service Contracts pattern when developing custom extensions?
-
A
It allows developers to write database queries without using the repository pattern
-
B
It provides a stable, versioned API that decouples the business logic from implementation details and frontend dependencies
✓ Correct
-
C
It reduces the amount of code needed by automatically generating database queries
-
D
It enables automatic REST API generation without additional configuration
Explanation
Service Contracts define clear interfaces between modules and layers, creating stable APIs that can evolve independently while maintaining backward compatibility and reducing coupling between components.
When implementing a plugin (interceptor) for a public method in Adobe Commerce, which plugin type allows modification of both arguments and the return value while controlling method execution?
-
A
Before plugin
-
B
Around plugin
✓ Correct
-
C
After plugin
-
D
Override plugin
Explanation
Around plugins wrap the entire method execution, allowing developers to modify input arguments, control whether the method executes, and modify the return value before it reaches the caller.
In Adobe Commerce REST API development, what does the term 'async routes' refer to?
-
A
API endpoints that return responses asynchronously using JavaScript callbacks
-
B
Routes that support both GET and POST methods simultaneously
-
C
API endpoints that require CORS headers for cross-origin requests
-
D
HTTP routes configured to handle requests using queue-based asynchronous message processing instead of synchronous execution
✓ Correct
Explanation
Async routes in Adobe Commerce allow long-running operations to be queued as asynchronous jobs, returning a response to the client immediately while the actual processing happens in the background.
What is the correct location for placing a custom layout XML file that should only apply to a specific module's pages?
-
A
app/design/frontend/Vendor/Theme/layout/custom/
-
B
app/design/frontend/Vendor/Theme/Magento_ModuleName/layout/
-
C
app/code/Vendor/ModuleName/layout/frontend/
-
D
app/code/Vendor/ModuleName/view/frontend/layout/
✓ Correct
Explanation
Custom layout files for a specific module should be placed in the module's view/frontend/layout/ directory, following Adobe Commerce's modular architecture and layout hierarchy.
When using Adobe Commerce's dependency injection container, what is the purpose of the 'shared' attribute in di.xml?
-
A
It determines whether a single instance should be reused (true) or a new instance created for each request (false)
✓ Correct
-
B
It marks a class as accessible across multiple modules within the dependency injection container
-
C
It specifies which other services can depend on this particular service definition
-
D
It enables the service to be used in both frontend and backend areas of the application
Explanation
The 'shared' attribute controls instance management: when true, the container reuses the same instance (singleton pattern), and when false, a new instance is created each time the service is requested.
In Adobe Commerce, which class should be extended to create a custom quote item type with specific pricing logic?
-
A
\Magento\Catalog\Model\Product
-
B
\Magento\Quote\Model\ResourceModel\Quote\Item
-
C
\Magento\Sales\Model\Order\Item
-
D
\Magento\Quote\Model\Quote\Item
✓ Correct
Explanation
The Quote\Model\Quote\Item class represents items in a shopping cart and can be extended to implement custom pricing and totals calculation logic for specific product types.
What is the correct way to add a custom attribute to the product collection's select query without breaking query optimization?
-
A
Use join() method to add the attribute table with proper indexing considerations
-
B
Add the attribute directly to the collection using addAttribute() method and let Adobe Commerce handle the joins
-
C
Use addAttributeToSelect() for extensible attributes or join() for custom tables
✓ Correct
-
D
Always load products one by one and attach attributes individually to avoid complex queries
Explanation
Adobe Commerce provides addAttributeToSelect() for EAV attributes which handles joins automatically, while custom table attributes require explicit join() calls to maintain query efficiency.
In Adobe Commerce, what does the term 'weak reference' mean in the context of event observers?
-
A
An observer configuration that allows the observed object to be garbage collected even while the observer holds a reference to it
✓ Correct
-
B
An observer that only listens to events during the current page load and is not persisted
-
C
An observer that has lower priority than other observers of the same event
-
D
An observer method that uses pass-by-reference parameters instead of copying data
Explanation
Weak references in observer patterns prevent memory leaks by allowing objects to be garbage collected, which is important for long-running processes in Adobe Commerce's event-driven architecture.
When developing a custom shipping method extension, which interface must the carrier model class implement?
-
A
\Magento\Shipping\Api\CarrierMethodInterface
-
B
Both CarrierInterface and extend AbstractCarrier
✓ Correct
-
C
\Magento\Shipping\Model\Carrier\AbstractCarrier
-
D
\Magento\Shipping\Model\CarrierInterface
Explanation
Custom shipping method classes must both implement CarrierInterface and extend AbstractCarrier class, which provides common functionality while enforcing the required interface contract.
In Adobe Commerce's Ui Component framework, what is the primary purpose of the 'virtual_category' layout handle?
-
A
It's deprecated and should not be used in new extensions
-
B
It enables lazy loading of category product listings
-
C
It applies UI components only to dynamically generated category pages
-
D
It provides default UI component configurations that can be extended for specific catalog pages and doesn't actually render a physical category page
✓ Correct
Explanation
The virtual_category handle is a layout handle that applies to all category pages, providing a base configuration for UI components that can be customized or overridden for specific categories.
What is the correct sequence for properly initializing a custom data model in Adobe Commerce using the repository pattern?
-
A
Use repository to load existing data → modify model → call save() method
-
B
Instantiate repository → use getList() to fetch models → modify → save through repository
-
C
Create factory → instantiate model → set data → use repository to save
-
D
All of the above are valid depending on the use case
✓ Correct
Explanation
The repository pattern in Adobe Commerce is flexible and supports multiple initialization paths: creating new instances via factory, loading existing data, or using repository's query methods, depending on the specific business requirement.
In Adobe Commerce, which mechanism allows a third-party module to modify the behavior of another module's model without directly extending or modifying the original code?
-
A
Virtual types and preference configuration in di.xml
-
B
Schema patches and data patches
-
C
Custom rewrites in the router configuration
-
D
Event observers and plugins (interceptors)
✓ Correct
Explanation
Event observers and plugins are the primary mechanisms for non-invasive customization, allowing modules to hook into and modify behavior at specific points without altering original code.
When implementing caching for custom GraphQL queries in Adobe Commerce, which cache type should typically be used for catalog-related data?
-
A
GraphQL queries cannot use Magento's standard cache tagging system
-
B
Magento\Catalog\Model\Product::CACHE_TAG
-
C
Either A or B are equivalent
✓ Correct
-
D
CACHE_TAG_PRODUCT
Explanation
Both constants refer to the same cache tag used for product data. Adobe Commerce allows GraphQL resolvers to use standard cache tags for proper cache invalidation when catalog data changes.
In Adobe Commerce, what is the primary difference between a 'virtual type' and a 'regular type' in dependency injection configuration?
-
A
Virtual types don't create a real class file and serve as aliases or variants of existing classes with different constructor arguments
✓ Correct
-
B
Virtual types are used only for testing and cannot be used in production code
-
C
Virtual types are automatically deprecated in Adobe Commerce 2.4 and above
-
D
Virtual types create a shared instance while regular types create new instances on each request
Explanation
Virtual types are lightweight DI configurations that create logical instances of existing classes with different constructor parameters without requiring new class files, enabling flexible service variations.
When creating a custom totals collector for the cart in Adobe Commerce, which class method is responsible for adding custom charges or discounts to the quote?
-
A
addTaxAmount()
-
B
collect() within a totals collector class extending AbstractCollector
✓ Correct
-
C
addToTotals() in the Quote observer
-
D
calculateCustomTotal() in the Quote model
Explanation
The collect() method in a custom totals collector class is where you implement logic to calculate and add custom charges, discounts, or fees to the quote totals.
In Adobe Commerce REST API authentication, what is the primary limitation of integration tokens compared to customer tokens?
-
A
Integration tokens expire after every API call requiring re-authentication
-
B
Integration tokens can only authenticate one API request while customer tokens persist across sessions
-
C
Integration tokens cannot be used for admin API calls
-
D
Integration tokens do not support scope-based access control and have a fixed set of permissions defined at integration creation time, whereas customer tokens use customer permissions
✓ Correct
Explanation
Integration tokens are assigned fixed permissions at integration setup and don't dynamically change with customer role changes, making them suitable for third-party services but less flexible than dynamic customer-based access.
Which Adobe Commerce mechanism ensures that a plugin is executed after all other plugins in the same interception chain?
-
A
Listing other plugins in the 'after' array within the plugin configuration
✓ Correct
-
B
Specifying a high priority value (100+) in plugin configuration
-
C
Declaring the plugin as a secondary plugin type
-
D
Using 'sortOrder' attribute set to a high number in etc/di.xml
Explanation
In Adobe Commerce, you can control plugin execution order by specifying which other plugins should execute before your plugin using the 'sortOrder' attribute or by declaring dependencies in the plugin configuration.
In Adobe Commerce, what is the purpose of the 'areas' configuration in module registration and how does it affect module functionality?
-
A
It defines which areas (frontend, adminhtml, webapi_rest, etc.) the module applies to, affecting where its configuration, layout, and code are loaded
✓ Correct
-
B
It determines the maximum number of concurrent users who can access the module
-
C
It specifies whether a module is available globally or restricted to specific geographic regions
-
D
It restricts module functionality to specific customer groups or store views
Explanation
Areas configuration in module registration controls in which parts of Adobe Commerce (storefront, admin, API, etc.) the module's resources are loaded, optimizing performance by preventing unnecessary code execution.
When implementing a custom product type in Adobe Commerce, which method must be overridden to define how the product calculates its final price with applied discounts?
-
A
calculatePrice() in the Product model
-
B
applyDiscount() in a custom price rule processor
-
C
getPriceModel()->getPrice() in the product's type configuration
-
D
getFinalPrice() or override the price indexer behavior
✓ Correct
Explanation
For custom product types, you should override the price indexer or implement custom logic in the type's price model to ensure discounts and special pricing are correctly calculated and indexed.
In Adobe Commerce, what is the correct approach to ensure database consistency when a declarative schema change conflicts with existing schema patches?
-
A
Run setup:db-declaration:generate-patches to create intermediate migration patches and resolve conflicts
✓ Correct
-
B
Manually edit the db_schema.xml file to match the current database state before deploying new changes
-
C
Delete all existing schema patches and rewrite them to match the new declarative schema definition
-
D
Use InstallSchema to override all declarative schema definitions
Explanation
Adobe Commerce provides the setup:db-declaration:generate-patches command to automatically generate patches that bridge the gap between declarative schema and existing patches, resolving conflicts gracefully.
When implementing a custom module in Adobe Commerce, which directory structure is required for the module to be properly recognized by the system?
-
A
app/code/Vendor/Module with registration.php and module.xml
✓ Correct
-
B
app/modules/VendorModule/config.xml
-
C
var/modules/Vendor_Module.xml
-
D
lib/internal/Vendor/Module/etc/module.xml
Explanation
Adobe Commerce requires modules to be located in app/code/Vendor/Module with both registration.php and etc/module.xml files. This is the standard module directory structure recognized by the module loader.
In Adobe Commerce, what is the primary purpose of the di.xml configuration file?
-
A
To define database table schemas and relationships
-
B
To configure dependency injection, constructor arguments, and virtual types
✓ Correct
-
C
To specify ACL rules and admin user permissions
-
D
To manage cache configuration and storage backends
Explanation
The di.xml file is used for dependency injection configuration in Adobe Commerce. It defines class dependencies, constructor arguments, shared instances, virtual types, and object manager preferences.
Which method should be used to safely retrieve configuration values in Adobe Commerce plugins and custom code?
-
A
Access configuration values through Magento\Framework\App\Config\ConfigSourceInterface
-
B
Use ScopeConfigInterface::getValue() with appropriate scope parameters
✓ Correct
-
C
Directly access $this->config array from the config object
-
D
Query the core_config_data table directly using raw SQL
Explanation
The ScopeConfigInterface::getValue() method is the recommended way to retrieve configuration values in Adobe Commerce. It properly handles scope resolution (default, website, store) and caching.
What is the correct way to observe a custom event in a module's events.xml file?
-
A
Register the observer class in di.xml with a special observer suffix
-
B
Define the event observer with event name, instance, and method attributes
✓ Correct
-
C
Create an Observer class and reference it in module's config.xml
-
D
Use the @Observer annotation in the observer PHP class directly
Explanation
The events.xml configuration file uses XML to define event observers with the event name, observer instance class, and method to call. This is the standard Adobe Commerce event observation mechanism.
In Adobe Commerce, what does the @api annotation indicate when used on a PHP class or interface?
-
A
The class/interface is part of the public API and maintains backward compatibility
✓ Correct
-
B
The class requires special API authentication to be accessed
-
C
The class is deprecated and should no longer be used in new code
-
D
The class is part of the internal implementation and can change without notice
Explanation
The @api annotation marks classes and interfaces as part of Adobe Commerce's public API, meaning they maintain backward compatibility between versions and are safe to extend or depend upon.
Which approach is recommended for modifying product behavior without directly editing core Adobe Commerce code?
-
A
Edit the core module files directly in vendor/magento directory
-
B
Override the class by copying it to app/code and modifying it
-
C
Create a custom plugin using before, after, or around interceptors
✓ Correct
-
D
Modify the database schema to add columns and change product behavior
Explanation
Plugins (interceptors) are the recommended way to extend or modify behavior in Adobe Commerce. They allow you to hook into methods with before, after, or around logic without modifying core code.
What is the purpose of the layout XML file in Adobe Commerce, and where should custom layout updates typically be stored?
-
A
Layout XML manages JavaScript dependencies; custom files belong in web/js/layout folder
-
B
Layout XML defines page structure, blocks, and containers; custom updates go in module's view/frontend/layout directory
✓ Correct
-
C
Layout XML controls caching behavior; updates should be placed in var/cache/layout directory
-
D
Layout XML configures database relationships; custom layouts should override in view/adminhtml directory
Explanation
Layout XML files define the page structure, blocks, and containers for frontend rendering. Custom layout updates should be placed in the module's view/frontend/layout/ directory following the route handle naming convention.
In Adobe Commerce, which interface should a custom model class implement to be properly managed by the Object Manager?
-
A
Magento\Framework\Api\ExtensibleDataInterface
-
B
Magento\Framework\Model\AbstractModel
-
C
Models don't need to implement a specific interface; dependency injection handles management
✓ Correct
-
D
Magento\Framework\DataObject
Explanation
Adobe Commerce's Object Manager uses dependency injection to manage class instances. While models typically extend AbstractModel, there's no required interface; the dependency injection configuration in di.xml determines how classes are instantiated and managed.
What is the correct syntax for defining a plugin that runs after a method execution in Adobe Commerce?
-
A
Define a method named afterMethodName in the plugin class and register it in di.xml
✓ Correct
-
B
Implement the AfterPluginInterface and register in module configuration
-
C
Create an after interceptor in events.xml with the method reference
-
D
Use the @plugin annotation above the method that should be executed afterward
Explanation
After plugins follow the naming convention 'after' + MethodName and are registered in di.xml. For example, an after plugin for getPrice() would be named afterGetPrice() and receives the result of the original method.
Which of the following best describes the purpose of preferences in the di.xml file?
-
A
Preferences specify caching preferences for different object types
-
B
Preferences configure the order in which plugins should be executed
-
C
Preferences define which concrete class should be instantiated when an interface is requested
✓ Correct
-
D
Preferences define user preferences and settings stored in the database
Explanation
In di.xml, preferences map interfaces to their concrete implementations. When the Object Manager is asked to inject an interface, it uses the preference to determine which concrete class to instantiate.
What is the role of the events.xml file in Adobe Commerce module development?
-
A
It configures calendar events for the admin panel
-
B
It manages email event notifications and alert configurations
-
C
It specifies which events the module should dispatch and which observers should listen
✓ Correct
-
D
It defines JavaScript event listeners for frontend interactions
Explanation
The events.xml file declares which observers should listen to which events. It maps event names to observer classes and methods, enabling loose coupling between modules through the event dispatcher mechanism.
In Adobe Commerce, how should you extend an existing table with additional columns for a custom module?
-
A
Create an InstallSchema class that defines the column additions in the install script
✓ Correct
-
B
Use a UpgradeSchema class when modifications are made to an existing module version
-
C
Directly modify the core table structure in the vendor directory
-
D
Add columns through the admin panel database configuration tool
Explanation
Custom schema modifications are defined in InstallSchema and UpgradeSchema classes within the module's Setup directory. These are executed during module installation and updates, ensuring proper versioning and repeatability.
Which class should be extended when creating a custom collection in Adobe Commerce?
-
A
Both A and B are correct and serve different purposes
-
B
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
✓ Correct
-
C
Magento\Framework\Api\SearchCriteria\CollectionProcessor
-
D
Magento\Framework\Data\Collection\AbstractDb
Explanation
Custom collections should extend AbstractCollection from the ResourceModel namespace. This provides the necessary methods for database queries, filtering, sorting, and pagination specific to Adobe Commerce models.
What is the purpose of the etc/webapi.xml file in an Adobe Commerce module?
-
A
It configures web server settings and virtual host information
-
B
It specifies external API integrations and webhook configurations
-
C
It defines REST API endpoints and their corresponding controller methods
✓ Correct
-
D
It manages API rate limiting and authentication token expiration
Explanation
The webapi.xml file declares REST API routes, mapping them to service classes and methods. It also defines the HTTP method, resource paths, and which operations are available for each endpoint.
In Adobe Commerce, what is the correct approach to add custom validation to a form in the admin panel?
-
A
Create a custom FormProcessor that validates data before form submission
-
B
Implement validation in the model and use data model validation rules defined in etc/validation.xml
-
C
Add validation rules directly to the form XML and implement a custom validator plugin
✓ Correct
-
D
All of the above approaches are equally valid for form validation
Explanation
Form validation in Adobe Commerce is achieved by defining validation rules in the form XML configuration (via form elements) and optionally creating plugins that intercept the validation process or extend form processors.
What is the primary function of the GraphQL schema.graphqls file in Adobe Commerce?
-
A
It configures database schema for GraphQL caching
-
B
It manages GraphQL server authentication and token validation
-
C
It defines GraphQL types, queries, mutations, and their relationships
✓ Correct
-
D
It specifies GraphQL API rate limiting policies
Explanation
The schema.graphqls file defines GraphQL types, queries, mutations, subscriptions, and their relationships in SDL (Schema Definition Language). This determines what data and operations are available through the GraphQL API.
Which of the following correctly describes how argument resolvers work in Adobe Commerce GraphQL?
-
A
They intercept and modify GraphQL arguments before they reach the field resolver
✓ Correct
-
B
They resolve complex argument types to simple values used in GraphQL queries
-
C
They map GraphQL arguments to database query parameters automatically
-
D
They validate GraphQL input arguments against defined schemas and constraints
Explanation
Argument resolvers in GraphQL intercept and process arguments passed to fields. They can transform, validate, or manipulate arguments before the field resolver uses them, enabling custom argument handling logic.
In Adobe Commerce, what is the difference between a Plugin and an Observer?
-
A
There is no functional difference; they are interchangeable mechanisms
-
B
Plugins are synchronous and modify object behavior; observers are asynchronous and respond to events
✓ Correct
-
C
Plugins work only on core classes; observers work only on custom modules
-
D
Observers are deprecated and should not be used in new development
Explanation
Plugins are synchronous interceptors that wrap method calls and can modify arguments, results, or behavior. Observers are event-based and asynchronous, responding to dispatched events without direct method interaction.
What should be the correct approach to safely add custom attributes to the Product model in Adobe Commerce?
-
A
Use InstallData or UpgradeData scripts to create custom attributes via AttributeSetup
✓ Correct
-
B
Create a new table and join it to the product table in collection queries
-
C
Directly add columns to the catalog_product_entity table
-
D
Use di.xml to extend the Product model with virtual attributes
Explanation
Custom product attributes should be created using InstallData or UpgradeData scripts with the AttributeSetup class. This properly creates EAV attributes with all necessary infrastructure, making them work with the standard attribute system.
In Adobe Commerce, which configuration file is used to define admin menu items and routes for a custom module?
-
A
etc/adminhtml/menu.xml and etc/adminhtml/routes.xml
✓ Correct
-
B
app/etc/admin/menu.xml
-
C
view/adminhtml/layout/menu.xml
-
D
etc/admin.xml and etc/config.xml
Explanation
Admin menu items are defined in etc/adminhtml/menu.xml with parent, title, and action attributes. Admin routes are configured in etc/adminhtml/routes.xml to define frontName and router classes for the admin panel.
What is the purpose of the module's composer.json file in Adobe Commerce?
-
A
It configures database connections for the module
-
B
It specifies module permissions and user roles
-
C
It manages module-specific cache configuration
-
D
It defines module dependencies, autoloading, and package information for distribution
✓ Correct
Explanation
The composer.json file declares the module's dependencies on other packages, defines PSR-4 autoloading rules, and provides package metadata. It enables the module to be installed and managed through Composer.
In Adobe Commerce, what is the correct way to dispatch a custom event from your module code?
-
A
Use EventManager::dispatch() after injecting EventManagerInterface into your class
✓ Correct
-
B
Register the event in events.xml and it will be automatically dispatched
-
C
Use the static Mage::dispatchEvent() method for legacy compatibility
-
D
Call Magento\Framework\Event\Manager directly with the event name
Explanation
To dispatch a custom event, inject EventManagerInterface and call its dispatch() method with the event name and optional data array. This is the proper dependency injection approach used in Adobe Commerce.
What does the virtual attribute type in di.xml allow you to do?
-
A
Declare methods that will be dynamically generated at runtime
-
B
Define attributes that exist in the database but are not physically stored
-
C
Create a wrapper around an existing class without modifying its code
-
D
Create a class that aggregates multiple object dependencies into a single instance
✓ Correct
Explanation
Virtual types in di.xml create new instances with shared configuration without being actual classes. They aggregate object dependencies and constructor arguments, useful for creating multiple variants of a class with different configurations.
In Adobe Commerce, how should you properly implement a custom transport handler for system emails?
-
A
Create a class implementing MailTransportFactoryInterface and configure it in di.xml
-
B
All of the above are equally valid approaches to implement custom mail transport
-
C
Implement TransportInterface and register in di.xml with a preference
✓ Correct
-
D
Extend Magento\Framework\Mail\Transport and override the sendMessage() method
Explanation
A custom mail transport should implement the TransportInterface and be registered as a preference in di.xml. This ensures proper integration with Adobe Commerce's mail sending system and allows other modules to use your transport handler.
When implementing a custom payment method in Adobe Commerce, which interface must your payment model implement to handle authorization and capture operations?
-
A
Magento\Payment\Model\MethodInterface
✓ Correct
-
B
Magento\Framework\Api\ExtensibleDataInterface
-
C
Magento\Payment\Model\InfoInterface
-
D
Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface
Explanation
The MethodInterface is the core interface that payment method models must implement to define authorization, capture, refund, and other payment operations in Adobe Commerce.
You need to create a database table migration using a declarative schema. Which file path correctly represents the location for this schema declaration?
-
A
app/code/Vendor/Module/etc/db_schema.xml
✓ Correct
-
B
app/code/Vendor/Module/data/db_schema.xml
-
C
app/code/Vendor/Module/Setup/db_schema.xml
-
D
var/log/db_schema.xml
Explanation
The declarative schema in Adobe Commerce uses the file path app/code/Vendor/Module/etc/db_schema.xml to define database table structures without requiring setup scripts.
A custom module needs to modify the product collection query to add a complex join with a custom attribute table. Which event should you observe to apply this modification without extending core classes?
-
A
catalog_product_load_after
-
B
eav_collection_abstract_load_before
✓ Correct
-
C
sales_order_item_collection_load_before
-
D
catalog_product_collection_load_before
Explanation
The eav_collection_abstract_load_before event fires before any EAV collection loads, allowing you to modify the query for product collections and other EAV-based collections without directly extending core classes.
When using the Repository pattern in Adobe Commerce, what should a repository's save() method return according to the framework standards?
-
A
The ID of the saved entity as an integer
-
B
A boolean value indicating success or failure
-
C
The entity object that was saved, with its identifier populated
✓ Correct
-
D
Void, as repositories use exceptions for error handling
Explanation
Adobe Commerce repositories following the standard pattern return the complete entity object after save operations, which includes the populated identifier for newly created records.
You are implementing a GraphQL mutation to create a custom order. Which component is responsible for validating and processing the mutation input data before persistence?
-
A
GraphQL Type definition
-
B
GraphQL Schema
-
C
GraphQL Resolver
-
D
Model class with business logic (Service/Command class)
✓ Correct
Explanation
While resolvers execute mutations and type definitions declare structure, the actual validation and processing logic should reside in service or command classes to maintain separation of concerns and reusability.
In Adobe Commerce, how should you properly implement a preference for a core class to ensure it works correctly with dependency injection and constructor argument forwarding?
-
A
Directly modify the Magento core files in vendor/magento
-
B
Override the class in app/code and modify the original file
-
C
Use an observer on a bootstrap event to swap class instances
-
D
Create a preference in di.xml that points to your custom class, ensuring your class extends or implements the original interface
✓ Correct
Explanation
Preferences in di.xml are the correct mechanism for replacing core classes while maintaining dependency injection compatibility and allowing proper constructor argument resolution.
When developing a custom shipping method, which class should you extend to ensure proper integration with Adobe Commerce's shipping calculation system and tax handling?
-
A
Magento\Quote\Model\Quote\Address\Rate
-
B
Magento\Framework\Model\AbstractModel
-
C
Magento\Shipping\Model\Carrier\AbstractCarrier
✓ Correct
-
D
Magento\Sales\Model\Order\Shipment
Explanation
AbstractCarrier provides the framework for implementing custom shipping methods with built-in support for rate calculation, error handling, and proper integration with the shipping system.
A developer needs to execute a complex business operation that spans multiple services and must be rolled back entirely if any step fails. What is the recommended approach in Adobe Commerce?
-
A
Use try-catch blocks in the controller to handle exceptions and manually revert database changes
-
B
Execute all operations sequentially and use observers to detect failures and trigger reversals
-
C
Wrap the operation in a database transaction using the connection's beginTransaction() and rollback() methods in a service class
✓ Correct
-
D
Use the message queue system to handle the operation asynchronously with retry logic
Explanation
Database transactions managed within service classes provide ACID compliance for multi-step operations, ensuring atomicity and proper rollback on failure without requiring manual reversion logic.
Which approach correctly implements custom validation logic for a custom attribute in the product entity?
-
A
Add a validate() method directly to the product model class
-
B
Create a validator class implementing Magento\Framework\Validator\ValidatorInterface and register it in di.xml for the product entity
✓ Correct
-
C
Use an observer on product_save_before to validate and throw exceptions
-
D
Add validation rules to the product's EAV attribute definition in the database
Explanation
The validator pattern with ValidatorInterface provides a clean, reusable, and maintainable way to implement custom validation logic that integrates with Adobe Commerce's validation framework.
When implementing a custom admin grid with filterable and sortable columns for a custom entity, what interface must your collection class implement to ensure compatibility with the grid UI component?
-
A
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
✓ Correct
-
B
Magento\Framework\Data\Collection\Db
-
C
Magento\Ui\DataProvider\AbstractDataProvider
-
D
Magento\Framework\Api\SearchCriteriaInterface
Explanation
AbstractCollection provides the necessary methods for filtering, sorting, and pagination that the admin grid UI component expects, ensuring proper data retrieval and manipulation.