# Integrate Purple Dot with Salesforce

Start by signing up to Purple Dot as a Merchant. If you don't have a Merchant Account yet, send us an email at <sales@getpurpledot.com> and we'll get you set up.

## Install the Purple Dot LINK cartridge

The Purple Dot LINK cartridge allows you to quickly integrate a Purple Dot instance into a Salesforce Commerce Cloud website. Download the Purple Dot cartridge and unzip its contents:

{% file src="<https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FFlXdUx2gK1GHtZhyvs3K%2Fpd-cartridge-2024-08-29.zip?alt=media&token=bc4369e8-2e8f-4c65-87f1-6ea01d5ebba7>" %}
v22.1.0 Cartridge (SHA256 14825fc5698ecc1442f463ebf1cb5e666b085e038c43f30929050489d2bcfd9b)
{% endfile %}

The Purple Dot cartridge enables customers to make pre-orders for out-of-stock products on the merchant’s site. The Purple Dot cartridge provides next features on the SFCC platform:

* Custom pre order button and cart elements on the storefront
* Dedicated configuration page in Business Manager
* Jobs which export and upload shipping methods, inventory lists and product catalogs to Purple Dot service
* Refunds (full or partial)

The cartridge is designed for Salesforce Commerce Cloud API version 22.6 (Compatibility Mode: 21.7) with StoreFront Reference Architecture (SFRA) version 6.0.0. It also supports older SiteGenesis (SG) sites. The cartridge is designed for the US and GB locales, but can work with other locales.

**Glossary**

<table><thead><tr><th width="248">Term</th><th>Description</th></tr></thead><tbody><tr><td>SFCC</td><td>Salesforce Commerce Cloud</td></tr><tr><td>Business Manager (BM)</td><td>The primary tool used to configure the SFCC platform and customer storefront SFRA</td></tr><tr><td>SFRA</td><td>StoreFront Reference Architecture</td></tr><tr><td>SG</td><td>SiteGenesis</td></tr></tbody></table>

### Set Up Business Manager

#### Import Purple Dot cartridges

1. Download the cartridge source code.
2. Establish a new digital server connection with your SFCC Instance.
3. Import cartridges to a workspace in Salesforce UX Studio.

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F36FVxOkfEM7UNaSmAEbG%2Fimage.png?alt=media&#x26;token=f80effb4-e025-4f9c-b11d-bf0fe80cc250" alt=""><figcaption></figcaption></figure>
4. Add cartridges to Project Reference of Server Connection.

   1. For **SFRA**, add the `int_purpledot` and `int_purpledot_sfra` cartridges.

      <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FF8kNPU1yiO51EXzP9A1P%2Fimage.png?alt=media&#x26;token=7caddbff-4f42-457c-ba50-ae2ee56540ad" alt=""><figcaption></figcaption></figure>
   2. For **SG**, add the `int_purpledot`, `int_purpledot_controllers`, and `purpledot_sg_changes` cartridges.

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FqXCg758tfDuQsatZXJUq%2Fimage.png?alt=media&#x26;token=819e5f42-b251-4676-8d12-fc105372d373" alt=""><figcaption></figcaption></figure>
5. Wait until Studio completes workspace build and uploads source codes to the sandbox.

#### Assign cartridges to the site

Go to `Administration > Sites > Manage Sites` and select your site from the list of “Storefront Sites”.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FZKqPnswYshTPdIGtLqFz%2Fimage.png?alt=media&#x26;token=e74c0b23-72ce-4848-be2d-6c3b06d5da4b" alt=""><figcaption></figcaption></figure>

Go to the Settings tab for your site.&#x20;

For **SFRA sites**, in the beginning of the cartridge path add the following:

`int_purpledot:int_purpledot_sfra:`

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FT8h2uWGWxxslorfywh7d%2Fimage.png?alt=media&#x26;token=a0cf1dfd-8411-43b1-a438-9ed4ddaca5f3" alt=""><figcaption></figcaption></figure>

**Note**: cartridge `storefront_base` is the core SFRA cartridge, which must be present as default SFRA cartridge to run SFRA sites.

For **SG sites**, in the beginning of the cartridge path add the following:

`purpledot_sg_changes:int_purpledot_controllers:int_purpledot:`

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FSwH5R3PBWwgrwpzBSpKK%2Fimage.png?alt=media&#x26;token=ca9e4b13-f360-4517-8271-c3f1276033c8" alt=""><figcaption></figcaption></figure>

Note: cartridges `storefront_controllers` and `storefront_core` are the core Controllers cartridges, which must be present as default Controller cartridges to run SG sites.

#### Import metadata

Go to `Administration > Site Development > Site Import & Export`. Create a zip archive of the `metadata` folder and upload *metadata.zip*.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FKDwCRd87XLfjIcN104IX%2Fimage.png?alt=media&#x26;token=ecdaa7e4-7651-4740-8e65-e747ad333a67" alt=""><figcaption></figcaption></figure>

Select *metadata.zip* and finish the import process.

### Configure Site

After import is successfully done, you should see the Purple Dot Custom Site Preference Group in the Business Manager by going to`Administration > Merchant Tools > Site Preferences > Custom Site Preferences`.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F7TXQOVK76EUiTH4aBStb%2Fimage.png?alt=media&#x26;token=ded0eeb1-958d-4f66-8b7e-36a006c06860" alt=""><figcaption></figcaption></figure>

#### Set custom site preferences

From `Administration > Merchant Tools > Site Preferences > Custom Site Preferences`, select **Purple Dot**.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FmcTwn8g1kcvA6iLo3e2E%2Fimage.png?alt=media&#x26;token=c3a8d83f-1d2f-4c98-a5e4-7a12c128fc5f" alt=""><figcaption></figcaption></figure>

The following preference values need to be set:

<table><thead><tr><th width="241">Preference name</th><th>Description</th></tr></thead><tbody><tr><td>Enable PurpleDot</td><td>Enable/disable all Purple Dot instances across the site</td></tr><tr><td>API key</td><td>Value for Purple Dot SDK. Your API key can be retrieved from Purple Dot by going to Settings > Integration > API Keys.</td></tr><tr><td>Secret Key</td><td>Value for JSON Web Token generator. Your Shared Secret Key can be retrieved from Purple Dot by going to Settings > Integration > API Keys.</td></tr><tr><td>Button style</td><td>Custom CSS styles for the Purple Dot pre-order button element.</td></tr><tr><td>Cart style</td><td>Custom CSS styles for the Purple Dot cart button element.</td></tr></tbody></table>

### Set Up Jobs

There are three jobs that need to be set up:

* PurpleDotCatalogExport
* PurpleDotInventoryExport
* PurpleDotShippingMethodsExport

**Note:** Catalog export job supports only one catalog at a time by default. If there is a need to upload more than one catalog, duplicate existing catalog export job and change its job ID to match the following pattern - **PurpleDot\_CatalogExportJob\_**\<YOUR CUSTOM SUFFIX>.

The following steps are similar for all Purple Dot jobs. The specific steps for job marked with the name of this particular job:

1. Go to Administration > Administration > Operations > Job Schedules > \[PurpleDot\_CatalogExport/PurpleDot\_InventoryExport/PurpleDot\_ShippingMethodsExport].
2. Go to the Schedule and History tab in order to define job intervals. Your catalogs/inventory lists/shipping methods will be synced in the Purple Dot system each time jobs have been scheduled.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FRaQI2JquPRidWfC8v9e3%2Fimage.png?alt=media&#x26;token=a52383df-3162-4bb9-bf10-1b515502c91b" alt=""><figcaption></figcaption></figure>

3. Go to the Job Step tab and click on the “Organization” button
4. Select needed site for every job step (**Note:** For the *CreateCatalogFeed* step in *PurpleDot\_CatalogExport job* the only applicable scope is “Organization”)

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FLFEhc6Qj6G5ZdEWepWxW%2Fimage.png?alt=media&#x26;token=2bdaa22b-1a19-4b8a-bdc9-1d190b5720a9" alt=""><figcaption></figcaption></figure>

5. **\[*****PurpleDot\_ExportCatalog job*****]** Open CreateCatalogFeed step, enter catalog ID to export in the “CatalogID” field and click the “Assign” button. (**Note:** Only “owned” products from catalog will be exported, “assigned” products will be ignored)

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F0j81b4MMlx7AnQptPjSF%2Fimage.png?alt=media&#x26;token=997a622c-f589-412a-97ac-fa059d1be6fd" alt=""><figcaption></figcaption></figure>

#### Provide Service Credentials

Go to `Administration > Operations > Services > Credentials`. Choose *purpledot.s3.aws.cred*.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FT2AcjPFAiMqSpq7Ac1o1%2Fimage.png?alt=media&#x26;token=621fa66a-4043-4a65-bac3-a1556e0c439e" alt=""><figcaption></figcaption></figure>

Enter service credentials provided by Purple Dot, setting the provided AWS access key as user and access secret as password.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FovG9VaSe1qzaCnMHCN1X%2Fimage.png?alt=media&#x26;token=7ccaeb6b-4c53-4e79-9e0e-3355e728d9c9" alt=""><figcaption></figcaption></figure>

Test that the jobs work by clicking Run Now.

**Warning:** If the jobs fails immediately or if the storefront isn't being updated, you might need to reactivate your current code version.

### OCAPI settings

**Warning:** OCAPI permissions need to be appended in addition to any pre-existing permissions.

Enter OCAPI permissions within Business Manager: `Administration > Site Development > Open Commerce API Settings`. See this “*purpledot ocapi shop.json*” file for required permissions.

{% file src="<https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F6bPVida0TN9KwFS49hhu%2Fpd_ocapi_shop.json?alt=media&token=088179d1-a908-417b-8454-9b8b748ba63b>" %}

{% file src="<https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FvGcTsbbcDUeauecHr2Cw%2Fpd_ocapi_data.json?alt=media&token=483078d9-0fd5-4ce8-ab58-0297cc4c2de9>" %}

The cartridge registers one hook-point to facilitate further customization:

* The hook-point *dw\.ocapi.shop.order.afterPATCH* is used to update payment status of the order placed with PurpleDot pre-order checkout

### Add Salesforce Commerce Cloud credentials to Purple Dot

In your Purple Dot Merchant Portal, go to Settings > Integration > Connected SFCC Store and click Connect. Fill in the SFCC instance and site you are connecting to, the OCAPI Client ID and password, if using a sandbox instance the Sandbox username and password, and click save. Credentials will be validated upon saving.

&#x20;![](https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FhfcmzIjGwBZ1qjnt6kxF%2FScreenshot%202024-08-07%20at%2016.32.59.png?alt=media\&token=445a6842-64fa-463a-b026-5e348c8a7983)

## Integrate Purple Dot with your SFRA site

### Edit models

**Note: all changes are already made in the int\_catch\_sfra cartridge.** **Files in the current cartridge use scripts and utilities from core cartridges. The file paths inside require() functions were changed to keep the relative paths to the core cartridges.**

For each of the following files, add the required code:

1. **app\_storefront\_base/cartridge/templates/default/purpleDot/cartbutton.isml**\
   If using the express checkout and a separate card, set `enableCart` to `false`:\
   `window.PurpleDot.init({ apiKey: '...', enableCart: false });`
2. **app\_storefront\_base/cartridge/models/product/decorators/index.js**

   Add the following row to the exported object in line 31 to extend product model decorators:

   ```jsx
   pdProduct: require('*/cartridge/models/product/decorators/pdProduct')
   ```
3. **app\_storefront\_base/cartridge/templates/default/common/htmlHead.isml**

   Add the following rows to line 32 to inject the Purple Dot SDK script and custom cartridge css styles to the page:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <link rel="stylesheet" href="${URLUtils.staticURL('/css/purpledot.css')}" />
   <isinclude template="purpleDot/sdkScript" />

   <iscomment>Purple Dot code</iscomment>
   ```
4. **app\_storefront\_base/cartridge/templates/default/components/header/headermenu.isml**

   Put the following rows to the line 33 to add link to Purple Dot self-service widget to the header menu:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <isif condition="${require('*/cartridge/scripts/purpleDot/helpers/pdHelper').getPreference('enable')}">

   	<li class="nav-item" role="presentation">
   		<a href="${URLUtils.https('PurpleDot-StatusPage')}" id="pd-history" class="nav-link" role="link" tabindex="0" target="_blank">${Resource.msg('link.name.preorderhistory', 'purpledot', null)}</a>
   	</li>

   </isif>

   <iscomment>Purple Dot code</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FpcqQaiDZXMwZcOYSE35S%2Fimage.png?alt=media&#x26;token=5dfc0165-4965-42b9-90c0-718af3750c98" alt=""><figcaption></figcaption></figure>
5. **app\_storefront\_base/cartridge/templates/default/components/header/pageHeader.isml**

   Add the following rows at line 45 to add the Purple Dot “Cart button” element to the page header:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <iscomment>Purple Dot Cart Button</iscomment>
   <isinclude template="purpleDot/cartbutton" />

   <iscomment>PurpleDot code</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FHCoysRODpACoHkTafyIu%2Fimage.png?alt=media&#x26;token=08959193-bef2-4c31-bf39-7ef27be07807" alt=""><figcaption></figcaption></figure>
6. **app\_storefront\_base/cartridge/templates/default/product/components/addToCartGlobal.isml**

   Wrap the button and input elements responsible for the native `addAllToCart` button on the PDPs with product sets and product bundles with following rows in line 3 to insert the Purple Dot Pre-order button on the page:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <isif condition="${product.pdProduct.isEnabled}">

   	<isset name="isInStock" value="${product.pdProduct.isInStock}" scope="page" />
   	<isset name="isAvailableForPreorder" value="${product.pdProduct.productToRender.availableForPreorder}" scope="page" />
   	<isset name="productIsSoldOut"
   		value="${!product.pdProduct.isInStock && !isAvailableForPreorder}"
   		scope="page" />
   	<isset name="productIsReadyToPreorder"
   		value="${!isInStock && isAvailableForPreorder}"
   		scope="page" />
   	<isset name="isMasterProductSelected" value="${product.pdProduct.masterProductID.trim() === product.id.trim()}" scope="page" />
   	<isset name="isSimpleProduct" value="${product.productType ==='standard'}" scope="page" />
   	
   	<input type="hidden" class="add-to-cart-url" value="${pdict.addToCartUrl}">
   	<button class="add-to-cart btn btn-primary ${(isMasterProductSelected && !isSimpleProduct) || productIsReadyToPreorder ? "d-none" : ""}"
   		data-toggle="modal" data-target="#chooseBonusProductModal"
   		data-pid="${product.id}"
   		${!product.readyToOrder || !product.available || productIsSoldOut ? "disabled" : ""}
   		aria-disabled="${productIsSoldOut}">
   		
   		<i class="fa fa-shopping-bag"></i>
   		<span>${productIsSoldOut ?  Resource.msg('button.title.soldout', 'purpledot', null) : Resource.msg('button.addtocart', 'common', null)}</span>
   	</button>

   	<iscomment>Purple Dot Preorder Button</iscomment>
   	<isinclude template="purpleDot/preorderbutton" />

   <iselse/>

   	... // template content goes here

   </isif>

   <iscomment>Purple Dot code</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FXXE8Yp4Xt9r0SJAM0McE%2Fimage.png?alt=media&#x26;token=cde7fe55-bda8-469e-a837-1fe8d4956c0f" alt=""><figcaption></figcaption></figure>
7. **app\_storefront\_base/cartridge/templates/default/product/components/addToCartGlobal.isml**

   Wrap the button and input elements responsible for the native `addToCart` button on the PDP with following rows in line 3 to insert the Purple Dot Pre-order button on the page:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <isif condition="${product.pdProduct.isEnabled}">

   	<isset name="isInStock" value="${product.pdProduct.isInStock}" scope="page" />
   	<isset name="isAvailableForPreorder" value="${product.pdProduct.productToRender.availableForPreorder}" scope="page" />
   	<isset name="productIsSoldOut"
   		value="${!product.pdProduct.isInStock && !isAvailableForPreorder}"
   		scope="page" />
   	<isset name="productIsReadyToPreorder"
   		value="${!isInStock && isAvailableForPreorder}"
   		scope="page" />
   	<isset name="isMasterProductSelected" value="${product.pdProduct.masterProductID.trim() === product.id.trim()}" scope="page" />

   	<input type="hidden" class="add-to-cart-url" value="${pdict.addToCartUrl}">

   	<button class="add-to-cart-global btn btn-primary ${isMasterProductSelected || productIsReadyToPreorder ? "d-none" : ""}"
   		data-pid="${product.id}"
   		${!product.readyToOrder || !product.available || productIsSoldOut  ? "disabled" : ""}
   		aria-disabled="${!productIsSoldOut}">

   		<i class="fa fa-shopping-bag"></i>
   		
   		<isif condition="${product.productType === 'set' || product.productType === 'bundle'}">
   		
   			<span>
   				${productIsSoldOut ? Resource.msg('button.addalltocart', 'common', null) : Resource.msg('button.title.soldout', 'purpledot', null)}
   			</span>
   			
   		<iselse>
   		
   			<span>
   				${productIsSoldOut ? Resource.msg('button.addtocart', 'common', null) : Resource.msg('button.title.soldout', 'purpledot', null)}
   			</span>

   		</isif>

   	</button>

   	<iscomment>Purple Dot Preorder Button</iscomment>
   	<isinclude template="purpleDot/preorderbutton" />

   <iselse/>

   	... // template content goes here

   </isif>

   <iscomment>Purple Dot code</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FhVJRmj5EmVSb3nN7Ddql%2Fimage.png?alt=media&#x26;token=b0527d9a-f6ca-4826-973c-4712a3e024ee" alt=""><figcaption></figcaption></figure>
8. **app\_storefront\_base/cartridge/templates/default/product/productTile.isml**

   Put the following rows to the line 21 to include pre-order label to the product tile:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <isinclude template="purpleDot/preorderlabel" />

   <iscomment>Purple Dot code</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FodnpvrIxRazRhKdjOcqC%2Fimage.png?alt=media&#x26;token=5a347b49-40af-4dc3-8d43-83b9674fc9cd" alt=""><figcaption></figcaption></figure>
9. **app\_storefront\_base/cartridge/templates/default/product/components/quantity.isml**

   Wrap the template elements responsible for the quantity number selection on the PDP with following rows in line to hide the quantity selector when the Purple Dot cartridge is enabled and Pre-order button is shown on the page:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <isif condition="${product.pdProduct.isEnabled}">

   	<isset name="isInStock" value="${product.pdProduct.isInStock}" scope="page" />
   	<isset name="isAvailableForPreorder" value="${product.pdProduct.productToRender.availableForPreorder}" scope="page" />

   	<label for="quantity-${loopState && loopState.count ? loopState.count : '1' }" class="${!isInStock && isAvailableForPreorder ? "d-none" : ""}">
   		${Resource.msg('label.quantity', 'common', null)}
   	</label>

   	<select class="quantity-select custom-select form-control ${!isInStock && isAvailableForPreorder ? "d-none" : ""}" id="quantity-${loopState && loopState.count ? loopState.count : '1' }">

   	<isloop items="${product.quantities}" var="quantity">
   		<option value="${quantity.value}"
   			<isif condition="${product.productType !== 'bundle'}">data-url="${quantity.url}"</isif>
   			${quantity.selected ? 'selected' : ''}
   		>
   			${quantity.value}
   		</option>
   	</isloop>

   	</select>

   <iselse/>

   	... // template content goes here

   </isif>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FjM5WpZv4MjP8XHhHk5Wc%2Fimage.png?alt=media&#x26;token=b5d6458d-ee5a-49f3-a1bb-6a3a28f0fd68" alt=""><figcaption></figcaption></figure>

### Edit client-side scripts

1. **app\_storefront\_base/cartridge/client/default/js/product/detail.js**

   Put the following row to the line 3 to add import helper function to the client-side script:

   ```jsx
   // Purple Dot code
   var pdHelper = require('../purpleDot/helpers/pdHelper');
   // Purple Dot code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FufQwPN3lK6PWU8nkjaZx%2Fimage.png?alt=media&#x26;token=4eff2929-c5fc-4897-8d0e-27db12eca377" alt=""><figcaption></figcaption></figure>

   Wrap native code responsible for update of the addToCart button in the updateAddToCart() function in the line 76 to replace change handling behavior of the addToCart button when cartridge is enabled:

   ```jsx
   // Purple Dot code
   if (response.product.pdProduct.isEnabled) {
   	pdHelper.handleAddToCartButton(response);
   } else {
   	... // client-side script content goes here
   }
   // Purple Dot code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FSnn8JzXW7dN3OQZeZSZy%2Fimage.png?alt=media&#x26;token=e450352d-cbcf-4c07-aec9-05619c609b57" alt=""><figcaption></figcaption></figure>
2. **app\_storefront\_base/cartridge/client/default/js/product/detail.js**

   ```jsx
   // Purple Dot code
   var pdHelper = require('../purpleDot/helpers/pdHelper');
   // Purple Dot code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2Fkkwnk1e5z40mxIJGypBh%2Fimage.png?alt=media&#x26;token=7c796f85-7358-4425-858e-bcf5b3b0134c" alt=""><figcaption></figcaption></figure>

   Add the following row to the line 80 in the `fillModalElement()` function to add custom function responsible for Purple Dot load script initialization on `quickView` modal window open:

   ```jsx
   // Purple Dot code
   pdHelper.initializePurpleDotLoadScript(data);
   // Purple Dot code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FSnWGDI9HciLlrOq1jUdo%2Fimage.png?alt=media&#x26;token=43895830-4fa8-461b-beb3-6f352b5f29b7" alt=""><figcaption></figcaption></figure>

   Add the following row to the line 153 in the `updateAddToCart()` function to handle `addToCart` button in the `quickView` modal window when cartridge is enabled:

   ```jsx
   // Purple Dot code
   if (response.product.pdProduct.isEnabled) {
   	pdHelper.handleAddToCartButton(response);
   } else {
   	// ... client-script content goes here
   }
   // Purple Dot code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F8FFuHq8bCbQyAFwMmoxh%2Fimage.png?alt=media&#x26;token=3e6e52b7-d452-4000-aa0d-4281306a359c" alt=""><figcaption></figcaption></figure>

## Integrate Purple Dot with your SG site

### Edit controllers

**Note:** **all changes are already made in the purpledot\_sg\_changes cartridge. Files in the current cartridge use scripts and utilities from core cartridges. The file paths inside require() and importScript() functions were changed to keep the relative paths to the core cartridges .**

1. app\_storefront \_controllers/cartridge/models/controllers/Product.js

   Put the following rows to the show()function in line31 to check if product is configured and available for pre-order via PurpleDot service:

   ```jsx
   // PurpleDot code start
   var productToRender = require('*/cartridge/scripts/purpleDot/helpers/pdHelper').getProductToRender(product);
   // PurpleDot code end
   ```

   Put the following row in line 39 to send value from the productToRender variable to the template’s pipeline dictionary:

   ```jsx
   productToRender: productToRender, // PurpleDot code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FwL3FLUJoFMdog84iCR1T%2Fimage.png?alt=media&#x26;token=5ecedd11-78c9-4a93-b9d6-5782e766c873" alt=""><figcaption></figcaption></figure>

   Put the following rows to the variation() function in line 220 to check if product’s variant is configured and available for preorder via PurpleDot service:

   ```jsx
   // PurpleDot code start
   var productToRender = require('*/cartridge/scripts/purpleDot/helpers/pdHelper').getProductToRender(product);
   // PurpleDot code end
   ```

   Extend object in getView() function with the following row in lines 238, 245, 253 to send value from the productToRender variable to the template’s pipeline dictionary:

   ```jsx
   productToRender: productToRender, // PurpleDot code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FtAQtf54qaxiKdqVWj1Qn%2Fimage.png?alt=media&#x26;token=e2a38a99-0580-4374-b63d-bc1943990136" alt=""><figcaption></figcaption></figure>

### Edit templates

1. **app\_storefront \_core/cartridge/templates/default/components/header/header.isml**

   Add the following rows to line 51 at the bottom of file to add the Purple Dot “Cart button” element to the page header:

   ```html
   <iscomment>Purple Dot Cart Button</iscomment>
   <isinclude template="purpleDot/cartbutton" />
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FPL30npMfgYaKITIxdOUl%2Fimage.png?alt=media&#x26;token=9bedeaa9-fe35-447e-9a52-cd1550cbbe52" alt=""><figcaption></figcaption></figure>
2. **app\_storefront \_core/cartridge/templates/default/components/header/header.isml**

   Add the following rows to the line 45 at the bottom of file to add a link to Purple Dot’s self-service widget to the header menu:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <isif condition="${require('*/cartridge/scripts/purpleDot/helpers/pdHelper').getPreference('enable')}">

   	<iscomment>Purple Dot self-service widget</iscomment>
   	<li>
   		<a href="${URLUtils.https('PurpleDot-StatusPage')}" title="Preorder History" target="_blank">
   			<span>${Resource.msg('link.name.preorderhistory', 'purpledot', null)}</span>
   		</a>
   	</li>

   </isif>

   <iscomment>Purple Dot code</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FKwVbGFy4hbEti97EmtG7%2Fimage.png?alt=media&#x26;token=fcadef9b-c500-4d10-a7a7-6f0478f93275" alt=""><figcaption></figcaption></figure>
3. **app\_storefront \_core/cartridge/templates/default/components/header/htmlhead.isml**

   Add the following rows at the line 30 to include Purple Dot SDK script in the page header:

   ```html
   <iscomment> Load the Purple Dot SDK </iscomment>
   <isinclude template="purpleDot/sdkScript"/>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FJcHpwHaUKXsvesQjmcnq%2Fimage.png?alt=media&#x26;token=04b49dc4-c4bb-47bd-96d5-948363c4bdd1" alt=""><figcaption></figcaption></figure>

   Add the following rows to the line 85 to add cartridge styles to the page header:

   ```html
   <!-- Purple Dot Styles -->
   <link rel="stylesheet" href="${URLUtils.staticURL('/css/purpleDot.css')}" />
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FUmLCgkPcSO1LEh5q8h1I%2Fimage.png?alt=media&#x26;token=8e26c54a-0dea-4c37-b8f5-c3e9391a805f" alt=""><figcaption></figcaption></figure>
4. **app\_storefront \_core/cartridge/templates/default/product/productcontent.isml**

   Add the following row to line 3 to add import helper function to the client-side script:

   ```html
   <iscomment>Purple Dot</iscomment>

   <isif condition="${pdict.Product.getAvailabilityModel().isInStock()}">

   	// ...template content goes here

   </isif>

   <iscomment>Purple Dot</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FfF72YFpdkIhcHUD5dagq%2Fimage.png?alt=media&#x26;token=f8d3bbe3-0a43-48f3-a1b6-0b013bbf6302" alt=""><figcaption></figcaption></figure>

   Wrap the block of the template responsible for “Add to cart” button with the following rows in line 226 to add the Purple Dot “Pre-order” button element on the PDP page:

   ```html
   <iscomment>Purple Dot</iscomment>

   <isif condition="${pdict.Product.getAvailabilityModel().isInStock()}">

   	// ...contents of the template go here

   <iselseif condition="${pdict.productToRender.availableForPreorder}"/>

   	<iscomment>PurpleDot Preorder Button</iscomment>
   	<isinclude template="purpleDot/preorderbutton" />

   <iselse/>

   	<button id="add-to-cart" type="button" title="${Resource.msg('button.title.soldout', 'purpledot', null)}" value="${Resource.msg('button.title.soldout', 'purpledot', null)}" class="button-fancy-large add-to-cart-disabled" disabled="disabled">${Resource.msg('button.title.soldout', 'purpledot', null)}</button>

   </isif>

   <iscomment>Purple Dot</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FT13w9iZvmsGxWHseIUm6%2Fimage.png?alt=media&#x26;token=7c69ef4d-0b95-4610-80b4-ce29ce0db7c0" alt=""><figcaption></figcaption></figure>
5. **app\_storefront\_core/cartridge/templates/default/product/producttile.isml**

   Add the following rows to the line 129 to add the “preorder label” element to the product tile component:

   ```html
   <iscomment>PurpleDot Pre-order label</iscomment>

   <isset name="pdProduct" value="${pdict.Product}" scope="page" />
   <isinclude template="purpleDot/preorderlabel" />
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2Fz2Ln5ekqcUdz46Mv5kdt%2Fimage.png?alt=media&#x26;token=3b224214-8ac2-4ead-9ceb-3d01f1f4f0ee" alt=""><figcaption></figcaption></figure>
6. **app\_storefront\_core/cartridge/templates/default/product/producttopcontentPS.isml**

   Wrap the form with the following rows in line 153 in the end of the file to add the Purple Dot “Pre-order” button element on the “bundle” product page:

   ```html
   <isif condition="${pdict.Product.getAvailabilityModel().isInStock()}">

   	// contents of the core cartridge go here

   <iselseif condition="${pdict.productToRender.availableForPreorder}"/>

   	<iscomment>Purple Dot Preorder Button</iscomment>
   	<isinclude template="purpleDot/preorderbutton" />

   <iselse/>

   	<button id="add-to-cart" type="button" title="${Resource.msg('button.title.soldout', 'purpledot', null)}" value="${Resource.msg('button.title.soldout', 'purpledot', null)}" class="button-fancy-large add-to-cart-disabled pd-sold-out" disabled="disabled">${Resource.msg('button.title.soldout', 'purpledot', null)}</button>

   </isif>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F0ZOgqgPFKUrNJ1IermEF%2Fimage.png?alt=media&#x26;token=c122d7e7-98be-45b1-bb99-d3506388946d" alt=""><figcaption></figcaption></figure>
7. **app\_storefront\_core/cartridge/templates/default/product/components/productsetproduct.isml**

   Wrap the form with the following rows in line 73 in the end of the file to add the Purple Dot “Pre-order” button element on the “bundle” product page:

   ```html
   <iscomment>Purple Dot code</iscomment>

   <isif condition="${pdict.Product.getAvailabilityModel().isInStock()}">

   	// ...form content

   <iselseif condition="${pdict.productToRender.availableForPreorder}"/>

   	<isinclude template="purpleDot/preorderbutton"/>

   <iselse />

   	<button id="add-to-cart" type="button" title="${Resource.msg('button.title.soldout', 'purpledot', null)}" value="${Resource.msg('button.title.soldout', 'purpledot', null)}" class="button-fancy-large add-to-cart-disabled" disabled="disabled">${Resource.msg('button.title.soldout', 'purpledot', null)}</button>

   </isif>

   <iscomment>Purple Dot code</iscomment>
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FDKjsRTvU7nGKHHzpfhvU%2Fimage.png?alt=media&#x26;token=0ef0d382-ad07-45e4-a331-29502d9ea86e" alt=""><figcaption></figcaption></figure>
8. **app\_storefront\_core/cartridge/templates/default/product/components/recommendations.isml**

   Add the following rows in line 47 to add the “pre-order label” element to the product tiles in the blocks with recommendations:

   ```html
   <iscomment>PurpleDot Pre-order label</iscomment>
   <isset name="pdProduct" value="${pdict.Product}" scope="page" />
   <isinclude template="purpleDot/preorderlabel" />
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FkcGTcnoBJoMHD5Flxu1p%2Fimage.png?alt=media&#x26;token=42ddc5a9-18ee-4caa-85ae-7abd2e20b9a9" alt=""><figcaption></figcaption></figure>

### Edit client-side scripts

1. **app\_storefront\_core/cartridge/js/pages/products/productSet.js**

   Put the following rows to the line 7 in the top of file to add the handleSoldoutButtonState() function responsible for keeping the “Sold out” button element disabled after page loads:

   ```jsx
   // PurpleDot code
   function handleSoldoutButtonState() {
   	var pdSoldoutButton = $('button.pd-sold-out');
   	
   	if (pdSoldoutButton.length > 0) {
   		pdSoldoutButton.prop('disabled', true);
   	}
   }
   // PurpleDot code
   ```

   Put the following rows to the line 32 in the top of file to the updateAddToCartButtons() function to keep “Sold out” button element disabled after page loads for ‘bundle’ products:

   ```jsx
   // PurpleDot Code
   handleSoldoutButtonState();
   // PurpleDot Code
   ```

   <figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FlD53lRw9ap7Y6n94Vumi%2Fimage.png?alt=media&#x26;token=cdc8463f-e99f-4644-abf2-81609c85b289" alt=""><figcaption></figcaption></figure>

### Additional client-side APIs

Here are some additional client side APIs that can be used to customise the storefront experience

#### numberOfPreorderItemsInBag

You can use the following code in your storefront to determine the number of preorder items that a shopper has added to their cart.

```javascript
window.PurpleDot.numberOfPreorderItemsInBag().then(
    (preorderItemsInBag) => {
        // ...
    }
);
```

#### openCheckout

You can open the Purple Dot checkout using the following code

```javascript
window.PurpleDot.openCheckout()
```

### Events

The Purple Dot client-side SDK emits the following events on the storefront.

| Event name          | Description                                                      |
| ------------------- | ---------------------------------------------------------------- |
| PurpleDot:Ready     | Emitted when the Purple Dot SDK is initialised and ready for use |
| PurpleDot:AddToCart | Emitted when the shopper has added a preorder item to their cart |

### Building a custom preorder checkout button

The above APIs and events can be leveraged to build a custom preorder checkout button. The following is a simplified example:

{% code overflow="wrap" lineNumbers="true" %}

```html
<body>
    <button id="preorder-checkout-button">Checkout</button>
    
    <script>
        const preorderCheckoutButton = document.querySelector(
            '#preorder-checkout-button'
        );
        
        preorderCheckoutButton.style.visibility = 'hidden';
        
        async function changeCheckoutButtonVisibility() {
            const numberOfPreorderItemsInBag = await window
                .PurpleDot
                .numberOfPreorderItemsInBag();
                
            preorderCheckoutButton.style.visibility = numberOfPreorderItemsInBag > 0
                ? 'initial'
                : 'hidden';
        }
        
        const eventsToListen = ['PurpleDot:Ready', 'PurpleDot:AddToCart'];
        
        for (const event of eventsToListen) {
            window.addEventListener(event, () => {
                changeCheckoutButtonVisibility();
            });
        }
        
        preorderCheckoutButton.addEventListener('click', (event) => {
            event.preventDefault();
            window.PurpleDot.openCheckout();
        });
    </script>
</body>
```

{% endcode %}

## Test the Integration

Follow the steps below to validate that you have successfully installed the Purple Dot cartridge.

### Business Manager \[Inventory Management]

All cartridge components are located in "Merchant Tools > Site Preferences > Custom Site Preference > PurpleDot".

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FScxm7WWYaBiHHW9v82JI%2Fimage.png?alt=media&#x26;token=99673cf1-4b30-4c02-9d2a-e383734954ca" alt=""><figcaption></figcaption></figure>

PurpleDot service needs to be enabled. Specify your *PurpleDot Public Key* and *PurpleDot API Key*.

#### **Configure product**

1. Go to Merchant Tools > Products and Catalogs >Inventory.
2. Choose an inventory book assigned to the current site.
3. Go to the “Records” tab, find the product that should be configured and click the “Edit” button.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FCOQkbDAZetzKy1V9Xhp7%2Fimage.png?alt=media&#x26;token=50a9eb1d-e4f0-468d-9fb3-0efdfcb639c9" alt=""><figcaption></figcaption></figure>

4. Configure the product’s availability settings by setting “Allocation” field value to 0.0 (zero).
5. Set the “None” checkbox in for the “Pre-Order/Backorder Handling” field.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FX3W9CfGfFoFGmEmSgsqx%2Fimage.png?alt=media&#x26;token=486030cf-5c3a-4eb8-894b-f3b619ebcef2" alt=""><figcaption></figcaption></figure>

Product Availability Status should change to **Not Available.**

#### **Synchronize catalog and shipping methods with Purple Dot platform**

1. Go to Administration > Operations > Jobs > \[\[PurpleDot\_Job]]

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FPcXGnPbhWF2JJPDCt5AG%2Fimage.png?alt=media&#x26;token=ce772c6a-3921-4c3c-a762-77c94f077555" alt=""><figcaption></figcaption></figure>

2. Run each job by clicking the “Run now” button

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FPdFpgWI9mg9PHlBWtDPH%2Fimage.png?alt=media&#x26;token=032bd7c6-ceb9-430f-964e-b0e750e12cca" alt=""><figcaption></figcaption></figure>

#### **Create waitlist in the Purple Dot dashboard**

3. Create a waitlist in the PurpleDot dashboard \[Putting a Product on Pre-order]

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FXzwhkJ22043tkoA0hyyw%2Fimage.png?alt=media&#x26;token=d99a8ba3-9983-420f-a800-8895cd0596f5" alt=""><figcaption></figcaption></figure>

4. Add configured product to the waitlist \[From your Catalogue]

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FTw2QU0uokMv0paoWQoyN%2Fimage.png?alt=media&#x26;token=a43d68f2-a9d7-4a14-b159-de5bb6a900e8" alt=""><figcaption></figcaption></figure>

5. Configure and save a waitlist.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FGOLqHu01Q0deQESjiHqJ%2Fimage.png?alt=media&#x26;token=4d08d6c4-ced9-4c71-9c2a-5f9095904bde" alt=""><figcaption></figcaption></figure>

### Storefront \[Visual Components – PDP, Checkout and Self Service]

#### PDP

On the PDP page with the configured product the custom “Pre-order” button should appear.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FexYMYroPn2jneENC9Hza%2Fimage.png?alt=media&#x26;token=5d61a5a8-98a9-45b0-b0db-12fae3904fed" alt=""><figcaption></figcaption></figure>

After adding the configured product to the pre-order list, the custom Purple Dot cart icon should appear near the default storefront cart icon.

In the BM inventory data should change:

* Pre-Order/Backorder Allocation: *your data*.
* Availability Status: **Pre-order**.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F6ozhl2dJlpqoctCQUMGs%2Fimage.png?alt=media&#x26;token=4708f1a5-5154-468f-bb2e-0fd7a718c500" alt=""><figcaption></figcaption></figure>

Proceed to checkout by clicking the “Checkout” button.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FmOuBli9V7jxKJA51vuPf%2Fimage.png?alt=media&#x26;token=31442ccc-8665-48a7-9ee5-fa31850b910b" alt=""><figcaption></figcaption></figure>

The modal window with Purple Dot pre-order checkout should appear.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F9x1cnegm7bjZ75Zyjzf9%2Fimage.png?alt=media&#x26;token=877f6db6-99b9-418b-8ed3-f41a4246910f" alt=""><figcaption></figcaption></figure>

#### **Pre-order label**

On the product tile of the configured product the “Pre-order” label should appear.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FJljn6G1VsE9WMTGwmDww%2Fimage.png?alt=media&#x26;token=631eb243-c149-4b0e-a0d8-becfaa384c4f" alt=""><figcaption></figcaption></figure>

#### **Self-service widget**

Click the “Pre-order history” link.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FKxnixpMs9Ic5iGq4Wb0n%2Fimage.png?alt=media&#x26;token=c6e4b791-79e1-426d-a6ca-305310d512df" alt=""><figcaption></figcaption></figure>

A new page with PurpleDot self-service widget should open.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FA7PaU75nZ2Mf6KPdfEGl%2Fimage.png?alt=media&#x26;token=f887eff7-42e8-4af9-a7a0-c7b37adf3bb5" alt=""><figcaption></figcaption></figure>

### Other \[Refund, Taxes and SSO]

#### **Refunds**

Place an order using Purple Dot pre-order checkout. Go to the Purple Dot dashboard and find your pre-order in the “Pre-orders” tab. Click on the pre-order.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FnnknYWT2D2CwujEyjXnr%2Fimage.png?alt=media&#x26;token=cf3c25ee-5879-4345-a636-cc5a20c86d1c" alt=""><figcaption></figcaption></figure>

Export your pre-order to the SFCC by clicking the “Export pre-order to SFCC button”.

Click the “Refund payment” button.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FhLfPSmjvb6r11wPtARKC%2Fimage.png?alt=media&#x26;token=fff7aa81-1f76-4793-abb0-923f45fb327a" alt=""><figcaption></figcaption></figure>

Enter the refund amount and click the “Confirm refund” button.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FXZPPW9uPJeYZor1iVH6R%2Fimage.png?alt=media&#x26;token=5d0dd730-3e4b-4830-9154-41ae0f058f3d" alt=""><figcaption></figcaption></figure>

Go to the BM: `Merchant Tools > Ordering > Orders` and find order.

<figure><img src="https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2FqkMwIpBm5GCNpJJ0Ec1b%2Fimage.png?alt=media&#x26;token=ff52534d-41c0-4fdf-9d58-1b241e6a52fa" alt=""><figcaption></figcaption></figure>

Check order notes. A note with the refund amount in the order’s “Notes” tab should appear in order notes.

#### **Taxes**

Configure manual tax rate in `Purple Dot -> Settings -> Taxes` or add your Vertex Key.

#### **Login**

Login to the Purple Dot dashboard is via an email magic link of SSO. See separate documentation for SSO configuration.

#### **Gift Cards**

If required, ask the Purple Dot team to enable the Clutch Gift Cards integration.

## Download Documentation

Download the full Purple Dot cartridge documentation:

{% file src="<https://35070260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F58PWmT9iYQoKNKYtPSZy%2Fuploads%2F8KsppKRtm2QYKoQUGZfo%2Fppd-22.1.0_documentation.zip?alt=media&token=0827e552-b5d2-48c2-8d8b-d9a56081aa1a>" %}
v22.1.0 Docs
{% endfile %}
