B2B Setup
1. Add the B2B App to the Relevant Project in ACC
In B2B Dynamic Settings, add a password
field in the Shop
configuration:
SHOP={
"key": "SHOP",
"value": {
"url": "{{SHOP_URL}}",
"shipping_option_slug": "b2b",
"payment_option_slug": "b2b"
...
"password": "B2B123456", // field to be added
}
}
2. Set Environment Value on the Shop Side
Ensure that the password
fields match on both sides:
B2B_EXTENSION_CONF={"api_url": "https://{B2B_APP_DOMAIN}/api/v1/", "password": "B2B123456"}
3. Define the Model Schema for User Model on the Shop Side
Enter this configuration via COMMERCE API as it will not reflect on forms within Omnitron screens:
{
"b2b_token": {
"key": "b2b_token",
"label": "B2B Token",
"data_type": "text"
},
"division_erp_code": {
"key": "division_erp_code",
"label": "B2B Division ERP Code",
"data_type": "text"
}
}
4. Integrate PromotionGateway for B2B Discounts on the Shop Side
Set the offer_priority
to the highest among existing campaigns.
{
"conf": {
"klass": "omnishop.promotions.backend.b2b.service.B2BPromotionService",
"offer_priority": 9999
},
"gateway": "b2b",
"id": 1,
"is_active": true,
"name": "b2b"
}
5. Add a ShippingOption for B2B on the Shop Side
Ensure the slug
in the created ShippingOption matches the shipping_option_slug
in Step 1.
{
"calculator": {
"name": "Free Calculator",
"slug": "free-calculator"
},
"delivery_type": "standard",
"description": null,
"id": 6,
"is_active": true,
"kwargs": {},
"name": "B2B",
"rule": {
"name": "Client Type Rule",
"slug": "client-type-rule",
"clients": [
"b2b"
]
},
"slug": "b2b"
}
6. Add a CargoCompany for B2B in Omnitron
{
"pk": 67,
"name": "b2b",
"erp_code": "b2b",
"shipping_company": "other",
"modified_date": "2023-09-01T09:41:10.288813Z",
"created_date": "2023-09-01T09:41:10.288781Z"
}
7. Configure PaymentOption for B2B on the Shop Side
Ensure the slug
matches the payment_option_slug
defined in Step 1.
{
"config": {
"rule": {
"klass": "omnishop.payments.rules.B2BPaymentRule",
"params": {}
}
},
"is_active": true,
"name": "B2B",
"payment_type": "b2b",
"slug": "b2b"
}