Order Installation
Version: 1.4.0 | 11 containers
Step-by-step
Use the following steps to install the Order component:
Install the packages
Install the required packages using npm:
npm install @dropins/tools @dropins/storefront-orderMap the packages
Add the drop-in to your importmap in the head.html file:
<script nonce="aem" type="importmap">{ "imports": { "@dropins/storefront-order/": "/scripts/__dropins__/@dropins/storefront-order/", "@dropins/tools/": "/scripts/__dropins__/tools/" }}</script>With the importmap defined, you can now import the required files from these packages into your block as described in the next step.
Import the required files
Import the necessary components and utilities:
// GraphQL Clientimport * as mesh from '@dropins/tools/fetch-graphql.js';
// Component toolsimport { initializers } from '@dropins/tools/initializer.js';
// Drop-in component providerimport { render as provider } from '@dropins/storefront-order/render.js';
// Drop-in component API functionsimport * as api from '@dropins/storefront-order/api.js';
// Drop-in component containersimport { CreateReturn } from '@dropins/storefront-order';Connect to the endpoint
Configure the GraphQL endpoint:
// Set endpoint configurationmesh.setEndpoint('https://<graphql-service-endpoint>/graphql');
// Set store code headermesh.setFetchGraphQlHeader('store', '<default>');Register and load the drop-in
Mount the initializers after the page has loaded:
// Register drop-in initializerinitializers.register(api.initialize, {});
// Mount initializers (must be called after all initializers are registered)initializers.mountImmediately(initialize, { langDefinitions });Render the drop-in
Render the CreateReturn container on your page:
// Render Orderprovider.render(CreateReturn, { // Add configuration options here})(document.getElementById('your-dropin-element'));Next steps
- Explore the API functions available for programmatic control
- Customize the appearance using slots
- Learn about events for integration with other components