Newer Version Available

This content describes an older version of this product. View Latest

Commerce Webstore Composite Products, Create

Add a product to your store and associate it with the specified category and media records.

When a store is created, these default records are automatically created: DefaultBuyerGroupId (maps to: BuyerGroup), DefaultEntitlementPolicyId (maps to: CommerceEntitlementPolicy), DefaultManagedContentSpaceId (maps to: ManagedContentSpace), DefaultPriceBookId (maps to: PriceBook2), DefaultProductCatalogId (maps to: ProductCatalog), and DefaultStrikeThroughPricebookId (maps to: PriceBook2).

This API works within the store's context, so when you make a create request, it automatically associates the product to default buyer group, entitlement policy, and price book records created during store setup, along with the current store's catalog. It also associates the specified category and media in the request. This streamlines product creation and enhances the efficiency of your online retail tasks.

If the API faces a problem associating the product to any store default records, it won't add the product with incomplete default store records. Instead, it cancels the product addition and rollbacks the creation request.

Currently, you can’t modify the default association of the product with these default records created during the store’s setup.

Note

Resource
1/commerce/management/webstore/${webstoreId}/composite-products
Resource example
1https://yourInstance.salesforce.com/services/data/v63.0/commerce/management/webstore/0ZEOK00000008vJ4AQ/composite-products
Available version
61.0
HTTP methods
POST
Request body for POST
JSON example
1{
2  "productFields": {
3    "Name": "Sample Product",
4    "Description": "This is a sample product",
5    "StockKeepingUnit": "110000",
6    "CustomField1__c": 9999,
7    "CustomField2__c": "some custom text"
8  },
9  "categoryIds": [
10    "0ZGxx0000000007GAA",
11    "0ZGxx0000000008GAA"
12  ],
13  "productMedia": [
14    {
15      "mediaId": "20Yxx0000011QskEAE",
16      "developerName": "productDetailImage"
17    },
18    {
19      "mediaId": "20Yxx0000011QslEAE",
20      "developerName": "productListImage"
21    }
22  ],
23  "attributeSetInfo": {
24    "id": "0iYxx0000000001EAA", // present if using an existing set
25    "name": "Apparel", // present if creating a new set
26    "attributes": [ // present if creating a new set
27      "Color__c",
28      "Size__c"
29    ]
30  }
31}
Properties
Name Type Description Required or Optional Available Version
attributeSetInfo Product Attribute Set Input Attribute set information for a variation parent product. Optional 62.0
categoryIds String[] A list of category IDs to be associated with the product. Optional 61.0
productFields Map<String, String> A map of product field names and their values. Required 61.0
productMedia Product Media Input[] A list of media records to be associated with the product. Optional 61.0
productPricing Product Pricing Input Details of the product pricing. Optional 61.0
Response body for POST
Composite Commerce Product Output