Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide for enabling shopping in third party integration #13601

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
59 changes: 59 additions & 0 deletions docs/third-party-integration/story-editor/integration-layer.md
Expand Up @@ -597,6 +597,65 @@ const Editor = () => {
};
```

## Enabling Shopping Tab

The shopping tab allows inserting a product attachment with a draggable drawer that links to the product URL. To enable the shopping tab, you need to make a couple of changes.

In the `StoryEditor` config, add `isShoppingEnabled: true` and `shoppingProvider: 'None'`. If you have a shopping provider like WooCommerce or Shopify you can add 'Woocommerce' or 'Shopify' instead of 'None'.

```jsx
<StoryEditor
config={{
apiCallbacks,
autoSaveInterval: 10,
capabilities: { hasUploadMediaAction:true,
canManageSettings: true, },
MediaUpload,
isShoppingEnabled: true,
shoppingProvider: 'None'
}}
initialEdits={{ story }}>
<InterfaceSkeleton header={<StoryEditorHeader />}
sidebarTabs={{
document: {
title: 'Document',
Pane: DocumentPane,
},
}}
/>
</StoryEditor>
```

Next, provide `getProducts` in `apiCallbacks`:

```jsx
const getProducts = () => {
const products = [
{
productId: "1",
productBrand: "Nike",
productDetails: "Random Nike sneaker",
productImages: [
{
alt: "Image",
url: "https://static.nike.com/a/images/c_limit,w_592,f_auto/t_product_v1/4f37fca8-6bce-43e7-ad07-f57ae3c13142/air-force-1-07-shoes-WrLlWX.png",
},
],
productPrice: 1000,
productPriceCurrency: "INR",
productTitle: "Nike Sneaker",
productUrl:
"https://www.nike.com/in/t/air-force-1-07-shoes-WrLlWX/315122-111",
},
];
return Promise.resolve({ products });
};

export default getProducts;
```

After configuring these, you will see a shopping bag icon which will hold products you return from the `getProducts` function. Clicking on the product will insert an attachment.

## Sidebar Tabs

### Document Pane
Expand Down