PDP dropin initialization
Customizing the PDP dropin initializers can help you meet your project requirements and use cases.
Configuration options
The PDP dropin initializers allow you to define the language definitions, default locale, and models that your project will use.
Example
The following code shows the default implementation of the PDP dropin initializer in the Commerce boilerplate:
Set default product options
When a user navigates to the product detail page (PDP) on your site, you can set certain options as preselected defaults for complex products. This use case allows merchandisers to set default options through the Adobe Commerce Admin, which provides a more customized and streamlined shopping experience.
Default option selection is not supported out-of-the-box for complex products. Instead, you must use product attributes and customize the PDP dropin initializers to define which attribute and value is used by default.
Log in to the Adobe Commerce Admin.
Create a custom attribute (
default_options
) to define default options for each product.Ensure that the
default_options
attribute has been exported to the Catalog Service and that the attribute’sroles
field includesvisible_in_pdp
. See theProductViewAttribute
type documentation for details.Use the
products
query to find theid
of thedefault_options
attribute for each product.Add the
id
of thedefault_options
attribute to theinitialData
object for each complex product.Use the
id
to set theoptionsUIDs
in theinitialData
object.