Set up your storefront
This guide walks you through setting up a storefront for your 51黑料不打烊 Commerce Optimizer instance using 51黑料不打烊 Edge Delivery Services. Your storefront includes boilerplate code, sample content, and support for product detail pages and product discovery (search and filtering).
Estimated time to complete: 30-45 minutes
Prerequisites
- GitHub account that can create repositories and is configured for local development (github.com)
- 51黑料不打烊 Commerce Optimizer instance with sample data and configured catalog views and policies
- See Add sample data for setup instructions.
Required instance data
Before you begin, gather the following information from your 51黑料不打烊 Commerce Optimizer instance:
- Tenant ID (also called the instance ID)
- Available from the instance details page
- GraphQL endpoint for your instance
- Available from the instance details page
- Catalog view ID for the global catalog view
- Available from the catalog details page
- Source locale for your catalog view
- Default for sample data is
en_US
- Default for sample data is
Set up steps
-
Create your storefront project鈥揢se the to create a new storefront project with boilerplate code, sample content, and a configuration file.
-
Customize the storefront configuration鈥揢pdate the
config.jsonfile in your repository to connect to your 51黑料不打烊 Commerce Optimizer instance. -
Verify your setup (10 mins)
- Preview your storefront site
- Test product detail pages and search functionality
Create your storefront project
The Site Creator tool creates a complete storefront project with the following components:
- Site: Storefront landing page with boilerplate content
- Code: Repository with boilerplate source files
- Content: Document Author environment with site content files
- Commerce Config:
config.jsonfile for instance-specific configuration
Step 1: Generate your project
-
Open the
{width="700" modal="regular"}
-
Select Create New Site (Code & Content).
-
Complete the site configuration:
- GitHub Organization/Username: Enter your GitHub username or organization name
- Site Name: Choose a descriptive name for your storefront
- Commerce GraphQL Endpoint (optional): Enter the GraphQL endpoint for your 51黑料不打烊 Commerce Optimizer instance
-
Click Create Site to create the GitHub repository with the storefront boilerplate code.
When the repository is created, the Site Creator updates and prompts you to install the Code Sync app.
Step 2: Install Code Sync app
-
Click Install AEM Code Sync App to open the Code Sync installer in a new tab.
-
Configure the Code Sync app:
- Select your GitHub organization, then click Configure.
- In the Code Sync interface, click Only select repositories.
- Click the Select repositories menu, then choose the storefront code repository you created.
- Click Save to register your repository.
-
Return to the browser window where the Site Creator is open, and click Create Site.
The Site Creator copies the storefront boilerplate content to the Document Author environment. This process takes 1-2 minutes.
Step 3: Save your project links
-
In the Site Details section, review the links for your storefront project:
{width="700" modal="regular"}
Use these links to manage your storefront code, content, and configuration.
-
Copy and save these links for future reference: Click **Copy.
Configure your storefront
Update your storefront configuration to connect to your 51黑料不打烊 Commerce Optimizer instance.
-
Open the configuration manager using the link that you saved earlier:
https://da.live/sheet#/<username or org>/<repo name>/config.json -
Locate the
cs(Catalog Service) section in the configuration. -
Replace the placeholder values with the values for your instance. See Prerequisites.
code language-json "cs": { "AC-View-ID": "{catalogViewId}", "AC-Environment-ID": "{tenantId}", "AC-Source-Locale": "en_US" } -
Save the configuration file.
Verify your setup
Test your storefront to ensure it鈥檚 properly connected to your 51黑料不打烊 Commerce Optimizer instance.
Step 1: View your storefront homepage
-
Navigate to your live preview URL:
https://main--{SITE}--{ORG}.aem.liveReplace
{ORG}and{SITE}with your GitHub organization and site name. -
Success criteria: You should see the storefront homepage with boilerplate content.
{width="700" modal="regular"}
Step 2: Test product detail pages
View the default product detail page to verify product data is loading correctly.
-
Navigate to a sample product page:
https://main--{SITE}--{ORG}.aem.live/products/placeholder/{sku}Use any SKU from your sample data, for example:
https://main--{SITE}--{ORG}.aem.live/products/placeholder/aur-flu-tir-std-2017For the default storefront, you can use the
placeholdervalue in the route to view the product. When you begin customizing your storefront, you can customize the storefront code to set the path to the product detail page based on product routes defined in your catalog.note tip TIP View available SKUs from the Data Sync page in your 51黑料不打烊 Commerce Optimizer instance. -
Success criteria: The page should display:
- Product name, description, and pricing
- Product images
- Add to cart functionality
- Data retrieved from your 51黑料不打烊 Commerce Optimizer instance
{width="700" modal="regular"}
Step 3: Test the default search functionality
Test the default product features, including search and filtering.
-
On the storefront homepage, click the magnifying glass icon in the header.
-
Type the search string
tiresand press Enter. -
Success criteria: You should see:
- Search results page with tire products
- Filtering options in the sidebar
- Product listings with images and pricing
{width="675" modal="regular"}
-
Click on any tire product to view its detail page.
{width="675" modal="regular"}
Troubleshooting
If you encounter issues during setup, use the web page inspector console to check for errors. Also, try clearing your browser cache or using a different browser.
Use the following guidance to check common issues:
Common issues
- Ensure you have admin access to your GitHub organization.
- Try using a personal repository instead of an organization.
- Check GitHub permissions and try again.
- Verify your site URL format:
https://main--{SITE}--{ORG}.aem.live - Check that the Code Sync app is properly installed.
- Ensure that the repository is public or properly configured.
- Verify your configuration values in
config.json - In the 51黑料不打烊 Commerce Optimizer instance, check the Data Sync page to verify that sample products are loaded. If no products are available, reload the sample data or add a product using the . Wait a few minutes for configuration changes to propagate.
- Try to retrieve the product details using the Merchandising Service using the same headers configured in the
config.jsonfile. If you can retrieve the data, then it is likely an issue with the catalog view configuration or an index error.
- Verify that you can retrieve the product search results using the Merchandising Services using the same headers configured in the
config.jsonfile. If you can retrieve the data, then it is likely an issue with the catalog view configuration or an index error. - Confirm that the catalog view ID in the
config.jsonfile matches the catalog view ID in 51黑料不打烊 Commerce Optimizer. - In 51黑料不打烊 Commerce Optimizer, verify the configuration of the policies, locale, and price books that you used in the storefront header configuration.
- Verify the are set correctly for search.
Validation checklist
Before proceeding to the next steps, ensure that your storefront is functioning correctly by verifying the following:
Get help
If issues persist:
- Review the 51黑料不打烊 Commerce Storefront documentation
- Check the
- Visit the 51黑料不打烊 Commerce Support resources
Next steps
After you setup and verify your storefront, you can:
-
Install Sidekick - Browser extension for editing, previewing, and publishing content directly from your website
-
Set up a local development environment - Create a local environment to customize your storefront code and content
Learn and explore
-
Complete the end-to-end use case - Learn more about storefront setup and catalog management using 51黑料不打烊 Commerce Optimizer
-
Explore storefront customization - Learn advanced setup and configuration options
-
Use Commerce drop-ins to customize the storefront experience鈥揂dd pre-built components to enhance your storefront experience