Deploy Store Metadata to a Target Org
The store metadata defines the store functionality.
Before you deploy metadata, review these Salesforce Developer topics:
- Metadata Components and Types
- Understanding Metadata API
- Deploying and Retrieving Metadata
- Salesforce CLI Command Reference
- Extract the store metadata from the source org. You can use Salesforce DX, Metadata API, DevOps Center, or change sets. DevOps Center provides a better and more collaborative experience to manage change sets.
- Deploy the store metadata to the target org, and perform any necessary post-deployment configuration.
- Test the store metadata deployment in the target org. Make sure that all components are working as expected.
- Prepare the Experience Bundle. Package the components of the Experience Bundle metadata, which can include Visualforce pages, Lightning components, Apex classes, and static resources.
- Test the experience metadata deployment in the target org.
- Deploy the Experience Bundle Metadata: Deploy the experience components to the target org.
- Test the entire B2B store experience in the target org to confirm that everything functions as expected.
You can deploy Store and Experience metadata using change sets in the Commerce app. Deploy the Store metadata first, and then the Experience metadata.
Follow the steps outlined in Migrate Your Store Configuration. Make sure that you configure the source and target deployment connections, and select store.org as the store component type.
Use the Salesforce Extensions for Visual Studio Code on Salesforce CLI to access Metadata API commands. The Salesforce Extensions for Visual Studio Code include tools for developing on the Salesforce platform in the lightweight, extensible VS Code editor. These tools provide features for working with development orgs (scratch orgs, sandboxes, and DE orgs), Apex, Aura components, and Visualforce.
Salesforce CLI is ideal if you use scripting or the command line for moving metadata between a local directory and a Salesforce org. For more information, see Salesforce Tools and Toolkits.
Here’s a high-level overview of how you can use Metadata API to deploy metadata from a source environment to a target environment. Your deployment requirements are unique to your organization and your approach can differ from these guidelines.
The command syntax for the CLI can differ. See the Salesforce CLI Command Reference for the most up-to-date information. Additionally, because the CLI is under active development, features and commands can change. Salesforce recommends you consult the latest Salesforce release notes or documentation for guidance on using the CLI for Salesforce Commerce metadata migration.
- Log in to your source and target orgs to authenticate.
- Back up your target org’s metadata and data before making changes.
- Retrieve metadata from the source org.
a. Identify the metadata components to deploy.
b. Create a
package.xml
manifest file that lists the components. c. To retrieve the metadata, use thesf project retrieve start
command with the —target-metadata—dir flag.
Example: sf project retrieve start --target-org SandboxAlias –-metadata CustomObjects -dir ./custom_objects --package-xml ./package.xml
- Deploy metadata to the target org using the
sf project deploy start
command. a. Example:sf project deploy start --target-org ProdAlias --source-dir ./custom_objects
- Monitor the deployment. Use the
sf project deploy validate
command. a. Perform post-deployment steps, such as data deployment or additional configuration in the target org. b. To ensure that everything works as expected, test your B2B Commerce store in the target org.
It’s important to establish a DevOps Center strategy that fits your organization’s requirements and to adopt tools that integrate well with your existing development workflow and deliver updates to users with minimal disruption.