DoliSharp.Shopify
8.0.6
dotnet add package DoliSharp.Shopify --version 8.0.6
NuGet\Install-Package DoliSharp.Shopify -Version 8.0.6
<PackageReference Include="DoliSharp.Shopify" Version="8.0.6" />
<PackageVersion Include="DoliSharp.Shopify" Version="8.0.6" />
<PackageReference Include="DoliSharp.Shopify" />
paket add DoliSharp.Shopify --version 8.0.6
#r "nuget: DoliSharp.Shopify, 8.0.6"
#:package DoliSharp.Shopify@8.0.6
#addin nuget:?package=DoliSharp.Shopify&version=8.0.6
#tool nuget:?package=DoliSharp.Shopify&version=8.0.6
DoliSharp.Shopify
Shopify ↔ Dolibarr connector for DoliSharp. It maps Shopify customers and orders to Dolibarr third parties and orders (webhooks), and can push warehouse stock to Shopify inventory.
This package is based on ShopifySharp (MIT), the .NET client for the Shopify Admin API. DoliSharp.Shopify uses ShopifySharp to talk to Shopify (products, variants, inventory levels) and to deserialize webhook payloads. It is a Dolibarr sync layer on top of ShopifySharp, not a fork of it.
Target framework: .NET 8. Depends on DoliSharp.
Features
- Webhook topics:
orders/create,orders/updated,orders/cancelled(ShopifyWebhookTopics) - Ensures a Dolibarr third party exists for the Shopify customer (match by email), then creates / updates / deletes the matching Dolibarr order
- Orders are correlated via Dolibarr
RefExt(Shopify-{orderId}) - Line items are matched to Dolibarr products by SKU ↔ product ref
ISyncStockService— copy Dolibarr warehouse stock onto Shopify inventory levels (SKU ↔ product ref)FulfillShopifyOrderCommand— fulfill remaining Shopify fulfillment orders (e.g. locker pickup) without notifying the customerorders/updatedupdates Dolibarr lines / third party but does not write order status (fk_statut)
Installation
dotnet add package DoliSharp
dotnet add package DoliSharp.Shopify
Quick start
Register DoliSharp first (order / product / third-party services), then the connector:
using DoliSharp;
using DoliSharp.Credentials;
using DoliSharp.Shopify;
using Microsoft.Extensions.DependencyInjection;
services.AddDoliSharp(new DolibarrCredentials(
Url: "https://your-dolibarr.example.com",
Token: "YOUR_DOLAPIKEY"
));
services.AddShopifyConnector(
shopifyUrl: "https://your-shop.myshopify.com",
shopAccessToken: "shpat_..."
);
AddShopifyConnector registers MediatR handlers from this assembly, ISyncStockService, and the ShopifySharp product / variant / inventory services.
Process a webhook
Forward the raw body and Shopify headers to MediatR. The host app is responsible for receiving HTTP webhooks (this package is a library, not an ASP.NET endpoint).
using DoliSharp.Shopify.Webhooks.Commands;
using DoliSharp.Shopify.Webhooks.Domain;
using ErrorOr;
using MediatR;
var webhook = new WebhookRequest(
Id: someId,
Body: rawJsonBody,
Headers: headerDictionary // X-Shopify-Topic, X-Shopify-Webhook-Id, …
);
ErrorOr<Success> outcome = await sender.Send(new ProcessShopifyWebhookCommand(webhook));
| Topic | Behavior |
|---|---|
orders/create |
Ensure third party exists, create and validate a Dolibarr order |
orders/updated |
Ensure third party exists, update the Dolibarr order with RefExt Shopify-{id} (lines / third party only; status is left unchanged) |
orders/cancelled |
Delete the matching Dolibarr order |
| other | Logged and ignored (Success) |
Sync stock Dolibarr → Shopify
Variants must have a SKU, inventory management set to Shopify, and a mapped location. Stock on the Dolibarr warehouse is written to the Shopify inventory level.
using DoliSharp.Shopify.Stock;
using DoliSharp.Shopify.Stock.Abstractions;
var sync = provider.GetRequiredService<ISyncStockService>();
var request = new StockSyncRequest()
.AddStockSyncWarehouse(dolibarWarehouseId: 1, shopifyWarehouseId: 123456789);
var movement = await sync.SynchroniseDolibarrWithShopifyAsync(request);
Fulfill a Shopify order
Used after locker pickup. Lists remaining fulfillment orders and creates a fulfillment (NotifyCustomer = false). Idempotent when none are open.
using DoliSharp.Shopify.Fulfillment;
ErrorOr<Success> fulfilled = await sender.Send(new FulfillShopifyOrderCommand(shopifyOrderId));
Requires Shopify scopes read_merchant_managed_fulfillment_orders and write_merchant_managed_fulfillment_orders.
Mapping
| Shopify | Dolibarr |
|---|---|
| Customer email | Third party (lookup / create / update) |
| Customer id | Third party RefExt = Shopify-{id} |
| Order id | Order RefExt = Shopify-{id} |
| Line item SKU | Product Ref |
| Variant SKU (stock sync) | Product Ref |
Error handling
Results use ErrorOr. Domain codes live in DoliSharp.Shopify.Domain.DomainErrors.
if (outcome.IsError)
return outcome.FirstError.Description;
License
DoliSharp.Shopify is licensed under the Apache License 2.0.
Shopify API access is provided by ShopifySharp, copyright Joshua Harms / Nozzlegear, licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- DoliSharp (>= 8.0.6)
- ErrorOr (>= 2.1.1)
- MediatR (>= 14.2.0)
- ShopifySharp (>= 6.11.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.