> For the complete documentation index, see [llms.txt](https://docs.xorosoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xorosoft.com/xoroerp-1/connected-apps/shopify/configuration-settings/b2b-sync/overview-and-setup-guide.md).

# Overview & Setup Guide

### **Shopify B2B Sync – Complete User Guide (Companies, Customers, Locations & Pricing)**

***

### **Overview**

B2B Sync allows businesses to manage:

* **Companies (B2B clients)**
* **Customers under those companies**
* **Multiple locations per company**
* **Custom pricing per company or location**

This ensures that:

* Orders are created correctly
* Pricing is applied accurately
* Customer hierarchy is maintained

***

#### **How to Think About B2B Sync (Simple Understanding)**

Before starting, understand this structure:

* **Company = Parent**
* **Locations = Child Customers**
* **Orders are always created for customers (locations)**

👉 So even if a company exists, orders are always tied to a **customer/location under that company**.

***

### **1. Company Sync – How Companies Are Created & Synced**

***

#### **What the user does**

1. Enable:
   * **B2B Company Sync**
   * **B2B Customer as Customer**
2. Save the settings

***

#### **What happens after enabling**

* A **Company Sync tab** appears in Shopify settings
* System is now ready to sync companies

***

#### **Creating a Company in Shopify**

* Go to:\
  **Shopify → Customers → Companies**
* Create a company

***

#### **What the system does**

* The company is synced into ERP
* It is created as a **Parent Customer**

***

#### **If the company has multiple locations**

* Each location becomes a **Child Customer**
* Structure becomes:

```
Company (Parent)
   ├── Location 1 (Customer)
   ├── Location 2 (Customer)
   └── Location 3 (Customer)
```

***

#### **Why this matters**

* Pricing can be applied:
  * Company-wise
  * Location-wise

### **2. Customer & Location Flow (Order Creation Logic)**

***

#### **Important Rule**

👉 Orders cannot be created without a **customer**

Even in B2B:

* Orders are created against **locations (customers)**
* Not directly against the company

***

#### **Default Customer Requirement**

To ensure orders always get created:

* A **default customer must exist**

#### What to do:

* Click **Create Customer**
* Use it as fallback for order creation

***

#### **Multiple Customers & Locations**

Users can:

* Create multiple customers
* Assign multiple locations per company

***

#### **Assigning Customer to Company**

While linking:

* A pop-up appears to assign customer to company

***

#### **Why this is important**

This is used for:

👉 **Pricing rules (especially location-based pricing)**

Example:

* Same company
* Different locations
* Different pricing

***

### **3. Company Sync in ERP**

***

#### **How to fetch companies**

Companies can be fetched using:

* Company ID
* Company Name
* Date Range

***

#### **Auto Import Feature**

* Automatically syncs companies at intervals
* Reduces manual effort

***

{% hint style="info" %}

#### **Important Requirement**

Currency must match:

* Customer currency
* Account currency

Otherwise:

* Orders will fail
  {% endhint %}

***

#### **Company Identifier**

* Each company has a **Company ID**
* Stored in a **custom field**
* Used for mapping betwen systems

***

### **4. B2B Pricing Sync**&#x20;

***

There are **two pricing approaches**:

***

#### **A. Pricing Based on Customer & Location (Advanced)**

***

#### **What this solves**

* Different prices for:
  * Different customers
  * Different locations

***

#### **Required Settings**

Enable:

* **Sync B2B Prices**
* **Sync B2B Locations in Catalog**

***

#### **How it works**

Pricing is applied based on:

* Customer
* Location
* Item

***

#### **Technical Flow (Simplified)**

System checks:

1. Item ID
2. Location ID
3. Customer mapping

Then applies pricing accordingly

***

#### **Custom Field Requirement**

* Custom fields must be defined for:
  * Item mapping
  * Location mapping

***

#### **Item Season Logic**

While creating pricing rules:

#### Option 1: Item Season

* Uses **Shopify Location ID**
* Applies pricing based on location

#### Option 2: Any

* Applies pricing to all items

***

{% hint style="warning" %}

### **Critical Condition**

Pricing rule works only if:

* Item exists in ERP
* Item has correct:
  * ID
  * Mapping
    {% endhint %}

***

#### **If item does not exist**

* Fetch item ID from Shopify
* Map it to ERP item via custom field

***

{% hint style="warning" %}

#### **Common Error:**&#x20;

If mapping is missing:

* Pricing sync fails
  {% endhint %}

***

#### **B. Default Pricing (Customer Group Based)**

***

#### **What this solves**

* Same pricing for:
  * Entire company
  * All locations

***

#### **How it works**

* Pricing is applied based on **customer group**

***

#### **Steps**

1. Create Pricing Rule:
   * Recipient Type = Customer Group
   * Define:
     * Currency
     * Discount / Markup
     * Price type
2. Assign:
   * Customer Group = Company

***

#### **Sync to Shopify**

* Go to Price Catalog
* Click **Sync Rule**

***

#### **Where to see in Shopify**

* Shopify → Catalog → Market

***

#### **Result**

* Pricing automatically applies during order creation

***

### **Location-Based Pricing (Advanced Use Case)**

***

#### **What this solves**

* Same company
* Different locations
* Different pricing

***

#### **How to do it**

* Create multiple pricing rules
* Each rule is mapped to a location

***

{% hint style="info" %}

#### **Mandatory Setting (Very Important)**

If **B2B Sync is enabled**:

👉 Enable:

* **Custom Field in Orders → General Settings**
  {% endhint %}

***

***

#### **Why is this required**

* Ensures:
  * Company mapping
  * Customer mapping
  * Order creation

Without this:

❌ Orders may fail

***

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.xorosoft.com/xoroerp-1/connected-apps/shopify/configuration-settings/b2b-sync/overview-and-setup-guide.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
