Global Bar — B2B and B2C store on Saleor
A HoReCa store where retail and closed wholesale run on one backend. It is built on Saleor that still receives updates: custom features live in separate modules, and integrations are connected as Saleor apps.
My role: Full-stack developer: adapting the Saleor backend and dashboard to the client's requirements, the B2B part, integration services for 1C, MAIB payments and images. Set up the project infrastructure on Coolify. Colleagues build the Next.js storefront.
The task
The old store runs on PrestaShop 1.6. The new one needs Romanian and Russian, retail and wholesale on one catalog, data from 1C, and card payments through MAIB.
Wholesale works differently from retail. Only an approved partner sees wholesale prices, an order is placed on behalf of a legal entity, and it is paid by bank transfer, with deferred payment or on delivery. So the store has to know who pays, how, and how much is already owed.
Architecture
The core is Saleor 3.23 (Django, GraphQL). Custom features live in separate modules; the services talk to the core through GraphQL and webhooks and never write to its database.
- Who uses itStorefrontNext.js, RO and RUDashboardSaleor Dashboard with B2B and content sections1Cexports of products, prices and stock
- EntryGraphQL APIthe single Saleor entry pointnginxstatic files and media
- Modules and servicesB2Bpartners, legal entities, prices, settlementsSearchmorphology, typos, suggestions, facets1CFastAPI: receiving exports and syncingMAIBFastAPI, ARQ: payments and refundsImagesproduct photo syncCMSWagtail, GraphQL with Strawberry
- Data and deploymentPostgreSQLdata and searchRedis, Celerycache and background tasksDocker, Coolifybuild and deploymentGitHub Actionslinters and tests of custom code
Key decisions
Saleor with its update history, not a detached copy
Saleor releases are merged in. Custom features live in separate Django apps and plugins, and every change to the core is recorded in a registry.
- Why
- The store gets security and payment fixes, and update conflicts are predictable.
- Trade-off
- Every update needs a full test run, and the GraphQL schema is generated again.
Wholesale is closed in the backend, not on the storefront
For everyone except approved partners and staff, the wholesale channel does not seem to exist. Access is checked when the channel is loaded and when a cart is created.
- Why
- Hiding a page is not enough: the API can be called without the storefront.
- Trade-off
- These are changes to the core's behavior, and they must be re-checked on every update.
The backend checks payment terms
A wholesale order cannot be created without a legal entity and a payment method, and deferred payment has to fit the credit limit. The payment method became a property of the order, not a payment gateway.
- Why
- Bank transfers and deferred payments bypass the store, so a gateway has nothing to process. And a check on the storefront can be bypassed.
- Trade-off
- The check is built into the shared order creation path, which is core code.
The personal price is computed on read
The partner's percentage is applied to the current price by one and the same function: in the catalog, cart, order and invoice. It is never written to the shared price fields.
- Why
- The price field is shared: one partner's discount written there would go to everyone.
- Trade-off
- There is one percentage for the whole range. Sorting and filtering by price rely on this.
Search changes the query, not the index
Saleor searches without morphology, and the catalog has two languages. The query goes through suffix trimming, synonyms, and correction of typos, keyboard layout and mixed alphabets.
- Why
- The index stays standard: nothing has to be reindexed after a synonym change, and the feature is switched off with one setting.
- Trade-off
- Trimming is simpler than real morphology. Some word forms are deliberately not merged, and tests pin this.
Facets in one request
Filter counts arrive in one request and are built from the same selection as the product list. Values are grouped by attribute type.
- Why
- The numbers in the panel match the results. Simple grouping would show the same brand as a separate row for every product.
- Trade-off
- No more than eight attribute filters per request; variant properties are not included in the panel.
Hard parts
A hook nobody called
The pricing plugin from the previous project overrode a hook that Saleor's calculation never uses. The test called it directly and passed. The calculation was moved to the base cart functions.
A dashboard one version newer
Of 237 changed dashboard files from the previous project, 194 conflicted with the new Saleor version and another 14 no longer existed in it. The features were carried over by meaning, not by file.
The PrestaShop catalog
Volume was written in four formats, prices sat in product combinations, and some addresses were duplicated. The import brings the data to one form, and it can be re-run and rolled back.
Two delivery prices
The storefront showed one amount while another went into the order. Now the backend computes the amount, and the storefront only displays it.
What's next
The store is in development, the launch is ahead.
New 1C exchange
Connect the export split into batches: products, prices, stock, warehouses and groups.
Catalog
Move the remaining sections from the old store.
Launch
Switch retail and wholesale to the new store.
Stack
- Backend
- Python, Django, Saleor 3.23, GraphQL, Celery
- Services
- FastAPI, Wagtail, Strawberry, Tortoise ORM, ARQ
- Data
- PostgreSQL, Redis
- Dashboard and storefront
- React, TypeScript, Next.js (storefront by colleagues)
- Deployment
- Docker, Coolify, GitHub Actions, GlitchTip
Need a similar system?
Tell me about the task — I reply within a day in RU, RO or EN.