> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# BulkAddProductsToStore

# Package: suppliersHub

# Namespace: MarketplaceProvider

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/suppliers-hub/marketplace-provider-service-plugin/bulk-add-products-to-store.md

## Introduction

Retrieves full product details from the marketplace provider and adds them to the site owner's Wix Stores catalog.

Wix calls this method when a site owner selects products to import from the marketplace provider.

Wix calls this method to create products in the site's Wix Stores catalog, linked to the provider's product IDs.

---

## REST API

### Schema

```
 Method: bulkAddProductsToStore
 Description: Retrieves full product details from the marketplace provider and adds them to the site owner's Wix Stores catalog.  Wix calls this method when a site owner selects products to import from the marketplace provider.  Wix calls this method to create products in the site's Wix Stores catalog, linked to the provider's product GUIDs.
 URL: {DEPLOYMENT-URI}/v2/bulk/add-products-to-store
 Method: POST
 Method parameters:
   param name: productReferences | type: array<productReferences> | description: Product references to add to the site owner's store.  | validation: minItems 1, maxItems 100
              - name: providerProductId | type: string | description: Unique product identifier on the provider's platform.  | validation: minLength 1, maxLength 36
              - name: options | type: object | description: Additional provider-specific data for this product. For example, other internal identifiers of the product on the provider's side.  
              - name: visibleInStore | type: boolean | description: Whether the product is visible in the site's store.  Default: `false`  
 Return type: BulkAddProductsToStoreResponse
  - name: results | type: array<BulkAddProductToStoreResult> | description: Results of adding each product to the store.  | validation: minItems 1, maxItems 100
     - name: itemMetadata | type: ItemMetadata | description: Item metadata.  
        - name: id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item).  | validation: minLength 1, maxLength 36
        - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.  
        - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated.  
        - name: error | type: ApplicationError | description: Details about the error in case of failure.  
           - name: code | type: string | description: Error code.  
           - name: description | type: string | description: Description of the error.  
           - name: data | type: object | description: Data related to the error.  
     - name: item | type: ProductReference | description: Added product reference.  
        - name: providerProductId | type: string | description: Unique product identifier on the provider's platform.  | validation: minLength 1, maxLength 36
        - name: options | type: object | description: Additional provider-specific data for this product. For example, other internal identifiers of the product on the provider's side.  
        - name: visibleInStore | type: boolean | description: Whether the product is visible in the site's store.  Default: `false`  
  - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.  
     - name: totalSuccesses | type: integer | description: Number of items that were successfully processed.  
     - name: totalFailures | type: integer | description: Number of items that couldn't be processed.  
     - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.  


```

### Examples

### Bulk Add Products To Store
Adds selected marketplace products to a Wix store in bulk

```curl
curl -X POST \
'https://provider.example.com/v2/bulk/add-products-to-store' \
-H 'user-agent: Wix' \
-H 'accept-encoding: gzip, deflate' \
-H 'content-type: text/plain; charset=utf-8' \
-d '{
  "productReferences": [
    {
      "providerProductId": "73cfa507-221b-417a-bd62-c7b62065068e",
      "visibleInStore": true
    },
    {
      "providerProductId": "ced405ed-fc48-4ace-987c-3677656e2fa7",
      "visibleInStore": true
    },
    {
      "providerProductId": "b1874e5f-a9fd-4362-8f5a-5193ba265bb1",
      "visibleInStore": false
    }
  ]
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.suppliersHub.marketplaceProvider.bulkAddProductsToStore(request, metadata)
 Description: Retrieves full product details from the marketplace provider and adds them to the site owner's Wix Stores catalog.  Wix calls this method when a site owner selects products to import from the marketplace provider.  Wix calls this method to create products in the site's Wix Stores catalog, linked to the provider's product GUIDs.
 Method parameters:
   param name: request | type: BulkAddProductsToStoreRequest    
        - name: productReferences | type: array<ProductReference> | description: Product references to add to the site owner's store.  | validation: minItems 1, maxItems 100
           - name: providerProductId | type: string | description: Unique product identifier on the provider's platform.  | validation: minLength 1, maxLength 36
           - name: options | type: object | description: Additional provider-specific data for this product. For example, other internal identifiers of the product on the provider's side.  
           - name: visibleInStore | type: boolean | description: Whether the product is visible in the site's store.  Default: `false`  
   param name: metadata | type: Context | description: this message is not directly used by any service, it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform. e.g. SPIs, event-handlers, etc.. NOTE: this context object MUST be provided as the last argument in each Velo method signature.  Example: ```typescript export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) { ... } ```  
        - name: requestId | type: string | description: A unique identifier of the request. You may print this GUID to your logs to help with future debugging and easier correlation with Wix's logs.  
        - name: currency | type: string | description: [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.  | validation: format CURRENCY
        - name: identity | type: IdentificationData | description: An object that describes the identity that triggered this request.  
           - ONE-OF: 
              - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.  | validation: format GUID
              - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.  | validation: format GUID
              - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).  | validation: format GUID
              - name: appId | type: string | description: GUID of an app.  | validation: format GUID
        - name: languages | type: array<string> | description: A string representing a language and region in the format of `"xx-XX"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash "-", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `"en-US"`.  
        - name: instanceId | type: string | description: The service provider app's instance GUID.  | validation: format GUID
 Return type: PROMISE<BulkAddProductsToStoreResponse>
  - name: results | type: array<BulkAddProductToStoreResult> | description: Results of adding each product to the store.  | validation: minItems 1, maxItems 100
     - name: itemMetadata | type: ItemMetadata | description: Item metadata.  
        - name: _id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item).  | validation: minLength 1, maxLength 36
        - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.  
        - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated.  
        - name: error | type: ApplicationError | description: Details about the error in case of failure.  
           - name: code | type: string | description: Error code.  
           - name: description | type: string | description: Description of the error.  
           - name: data | type: object | description: Data related to the error.  
     - name: item | type: ProductReference | description: Added product reference.  
        - name: providerProductId | type: string | description: Unique product identifier on the provider's platform.  | validation: minLength 1, maxLength 36
        - name: options | type: object | description: Additional provider-specific data for this product. For example, other internal identifiers of the product on the provider's side.  
        - name: visibleInStore | type: boolean | description: Whether the product is visible in the site's store.  Default: `false`  
  - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.  
     - name: totalSuccesses | type: integer | description: Number of items that were successfully processed.  
     - name: totalFailures | type: integer | description: Number of items that couldn't be processed.  
     - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.  


```

### Examples

### bulkAddProductsToStore
```javascript
import { marketplaceProvider } from '@wix/suppliers-hub/service-plugins';

async function bulkAddProductsToStore(request,metadata) {
  const response = await marketplaceProvider.bulkAddProductsToStore(request,metadata);
};
```

### bulkAddProductsToStore (with elevated permissions)
```javascript
import { marketplaceProvider } from '@wix/suppliers-hub/service-plugins';
import { auth } from '@wix/essentials';

async function myBulkAddProductsToStoreMethod(request,metadata) {
  const elevatedBulkAddProductsToStore = auth.elevate(marketplaceProvider.bulkAddProductsToStore);
  const response = await elevatedBulkAddProductsToStore(request,metadata);
}
```

### bulkAddProductsToStore (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { marketplaceProvider } from '@wix/suppliers-hub/service-plugins';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { marketplaceProvider },
  // Include the auth strategy and host as relevant
});


async function bulkAddProductsToStore(request,metadata) {
  const response = await myWixClient.marketplaceProvider.bulkAddProductsToStore(request,metadata);
};
```

---