@mercurjs/docs 2.2.0-canary.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/content/blocks.mdx +209 -0
- package/content/learn/architecture.mdx +215 -0
- package/content/learn/attributes.mdx +89 -0
- package/content/learn/blocks.mdx +99 -0
- package/content/learn/commissions.mdx +175 -0
- package/content/learn/concepts.mdx +84 -0
- package/content/learn/installation.mdx +117 -0
- package/content/learn/introduction.mdx +71 -0
- package/content/learn/offers.mdx +78 -0
- package/content/learn/order-groups.mdx +114 -0
- package/content/learn/payouts.mdx +175 -0
- package/content/learn/product-requests.mdx +82 -0
- package/content/learn/products.mdx +79 -0
- package/content/learn/registry.mdx +155 -0
- package/content/learn/seller-members.mdx +62 -0
- package/content/learn/sellers.mdx +118 -0
- package/content/migration/from-1-x-to-2-0.mdx +152 -0
- package/content/migration/from-2-0-to-2-1.mdx +105 -0
- package/content/migration/overview.mdx +58 -0
- package/content/references/api/admin/commission-rates/batch-commission-rules.mdx +70 -0
- package/content/references/api/admin/commission-rates/create-commission-rate.mdx +95 -0
- package/content/references/api/admin/commission-rates/delete-commission-rate.mdx +40 -0
- package/content/references/api/admin/commission-rates/list-commission-rates.mdx +92 -0
- package/content/references/api/admin/commission-rates/retrieve-commission-rate.mdx +70 -0
- package/content/references/api/admin/commission-rates/update-commission-rate.mdx +84 -0
- package/content/references/api/admin/members/list-members.mdx +61 -0
- package/content/references/api/admin/offers/batch-create-offers.mdx +130 -0
- package/content/references/api/admin/offers/delete-offer.mdx +40 -0
- package/content/references/api/admin/offers/list-offers.mdx +106 -0
- package/content/references/api/admin/offers/retrieve-offer.mdx +82 -0
- package/content/references/api/admin/order-groups/list-order-groups.mdx +77 -0
- package/content/references/api/admin/order-groups/retrieve-order-group.mdx +56 -0
- package/content/references/api/admin/orders/get-order-commission-lines.mdx +65 -0
- package/content/references/api/admin/orders/get-order-order-group.mdx +56 -0
- package/content/references/api/admin/orders/list-orders.mdx +79 -0
- package/content/references/api/admin/payouts/list-payouts.mdx +75 -0
- package/content/references/api/admin/payouts/retrieve-payout.mdx +62 -0
- package/content/references/api/admin/product-attributes/create-attribute-value.mdx +76 -0
- package/content/references/api/admin/product-attributes/create-product-attribute.mdx +99 -0
- package/content/references/api/admin/product-attributes/delete-attribute-value.mdx +52 -0
- package/content/references/api/admin/product-attributes/delete-product-attribute.mdx +40 -0
- package/content/references/api/admin/product-attributes/list-product-attributes.mdx +91 -0
- package/content/references/api/admin/product-attributes/retrieve-product-attribute.mdx +81 -0
- package/content/references/api/admin/product-attributes/update-attribute-value.mdx +66 -0
- package/content/references/api/admin/product-attributes/update-product-attribute.mdx +76 -0
- package/content/references/api/admin/product-changes/cancel-product-change.mdx +68 -0
- package/content/references/api/admin/product-changes/confirm-product-change.mdx +47 -0
- package/content/references/api/admin/products/batch-product-attributes.mdx +96 -0
- package/content/references/api/admin/products/confirm-product.mdx +59 -0
- package/content/references/api/admin/products/create-product-variant.mdx +78 -0
- package/content/references/api/admin/products/create-product.mdx +169 -0
- package/content/references/api/admin/products/delete-product-variant.mdx +48 -0
- package/content/references/api/admin/products/delete-product.mdx +40 -0
- package/content/references/api/admin/products/list-product-variants.mdx +91 -0
- package/content/references/api/admin/products/list-products.mdx +109 -0
- package/content/references/api/admin/products/preview-product.mdx +78 -0
- package/content/references/api/admin/products/reject-product.mdx +59 -0
- package/content/references/api/admin/products/request-product-changes.mdx +59 -0
- package/content/references/api/admin/products/retrieve-product-variant.mdx +73 -0
- package/content/references/api/admin/products/retrieve-product.mdx +96 -0
- package/content/references/api/admin/products/set-product-sellers.mdx +47 -0
- package/content/references/api/admin/products/update-product-variant.mdx +89 -0
- package/content/references/api/admin/products/update-product.mdx +133 -0
- package/content/references/api/admin/sellers/add-seller-member.mdx +63 -0
- package/content/references/api/admin/sellers/approve-seller.mdx +54 -0
- package/content/references/api/admin/sellers/create-seller.mdx +100 -0
- package/content/references/api/admin/sellers/delete-member-invite.mdx +42 -0
- package/content/references/api/admin/sellers/delete-professional-details.mdx +52 -0
- package/content/references/api/admin/sellers/invite-seller-member.mdx +63 -0
- package/content/references/api/admin/sellers/list-member-invites.mdx +71 -0
- package/content/references/api/admin/sellers/list-seller-members.mdx +71 -0
- package/content/references/api/admin/sellers/list-seller-products.mdx +85 -0
- package/content/references/api/admin/sellers/list-sellers.mdx +96 -0
- package/content/references/api/admin/sellers/remove-seller-member.mdx +42 -0
- package/content/references/api/admin/sellers/resend-member-invite.mdx +55 -0
- package/content/references/api/admin/sellers/retrieve-seller.mdx +81 -0
- package/content/references/api/admin/sellers/suspend-seller.mdx +60 -0
- package/content/references/api/admin/sellers/terminate-seller.mdx +60 -0
- package/content/references/api/admin/sellers/unsuspend-seller.mdx +52 -0
- package/content/references/api/admin/sellers/unterminate-seller.mdx +52 -0
- package/content/references/api/admin/sellers/update-seller.mdx +83 -0
- package/content/references/api/admin/sellers/upsert-payment-details.mdx +88 -0
- package/content/references/api/admin/sellers/upsert-professional-details.mdx +78 -0
- package/content/references/api/admin/sellers/upsert-seller-address.mdx +91 -0
- package/content/references/api/admin.mdx +134 -0
- package/content/references/api/conventions.mdx +109 -0
- package/content/references/api/store/carts/add-line-item.mdx +115 -0
- package/content/references/api/store/carts/add-shipping-methods.mdx +84 -0
- package/content/references/api/store/carts/apply-promotions.mdx +83 -0
- package/content/references/api/store/carts/complete-cart.mdx +98 -0
- package/content/references/api/store/offers/list-offers.mdx +161 -0
- package/content/references/api/store/offers/retrieve-offer.mdx +112 -0
- package/content/references/api/store/order-groups/list-order-groups.mdx +105 -0
- package/content/references/api/store/order-groups/retrieve-order-group.mdx +78 -0
- package/content/references/api/store/product-attributes/list-product-attributes.mdx +134 -0
- package/content/references/api/store/product-attributes/retrieve-product-attribute.mdx +78 -0
- package/content/references/api/store/product-categories/list-product-categories.mdx +126 -0
- package/content/references/api/store/product-categories/retrieve-product-category.mdx +79 -0
- package/content/references/api/store/products/list-products.mdx +184 -0
- package/content/references/api/store/products/retrieve-product.mdx +107 -0
- package/content/references/api/store/search/search.mdx +136 -0
- package/content/references/api/store/sellers/list-sellers.mdx +105 -0
- package/content/references/api/store/sellers/retrieve-seller.mdx +62 -0
- package/content/references/api/store/shipping-options/list-shipping-options.mdx +74 -0
- package/content/references/api/store.mdx +67 -0
- package/content/references/api/vendor/members/accept-member-invite.mdx +65 -0
- package/content/references/api/vendor/members/retrieve-current-member.mdx +51 -0
- package/content/references/api/vendor/members/update-current-member.mdx +70 -0
- package/content/references/api/vendor/offers/batch-create-offers.mdx +123 -0
- package/content/references/api/vendor/offers/batch-offer-inventory-items.mdx +103 -0
- package/content/references/api/vendor/offers/create-offer.mdx +141 -0
- package/content/references/api/vendor/offers/delete-offer.mdx +51 -0
- package/content/references/api/vendor/offers/list-offers.mdx +125 -0
- package/content/references/api/vendor/offers/retrieve-offer.mdx +74 -0
- package/content/references/api/vendor/offers/update-offer.mdx +82 -0
- package/content/references/api/vendor/orders/cancel-fulfillment.mdx +63 -0
- package/content/references/api/vendor/orders/cancel-order.mdx +56 -0
- package/content/references/api/vendor/orders/complete-order.mdx +55 -0
- package/content/references/api/vendor/orders/create-fulfillment.mdx +76 -0
- package/content/references/api/vendor/orders/create-shipment.mdx +99 -0
- package/content/references/api/vendor/orders/get-order-commission-lines.mdx +66 -0
- package/content/references/api/vendor/orders/list-order-changes.mdx +75 -0
- package/content/references/api/vendor/orders/list-orders.mdx +103 -0
- package/content/references/api/vendor/orders/mark-fulfillment-delivered.mdx +62 -0
- package/content/references/api/vendor/orders/preview-order.mdx +65 -0
- package/content/references/api/vendor/orders/retrieve-order.mdx +84 -0
- package/content/references/api/vendor/payout-accounts/create-onboarding.mdx +68 -0
- package/content/references/api/vendor/payout-accounts/create-payout-account.mdx +59 -0
- package/content/references/api/vendor/payout-accounts/retrieve-payout-account-by-id.mdx +60 -0
- package/content/references/api/vendor/payout-accounts/retrieve-payout-account.mdx +77 -0
- package/content/references/api/vendor/payouts/list-payouts.mdx +90 -0
- package/content/references/api/vendor/payouts/retrieve-payout.mdx +63 -0
- package/content/references/api/vendor/product-attributes/list-product-attributes.mdx +135 -0
- package/content/references/api/vendor/product-attributes/retrieve-product-attribute.mdx +71 -0
- package/content/references/api/vendor/product-variants/list-variants.mdx +136 -0
- package/content/references/api/vendor/products/batch-product-attributes.mdx +104 -0
- package/content/references/api/vendor/products/cancel-product-change.mdx +62 -0
- package/content/references/api/vendor/products/create-product-variant.mdx +92 -0
- package/content/references/api/vendor/products/create-product.mdx +197 -0
- package/content/references/api/vendor/products/delete-product-variant.mdx +68 -0
- package/content/references/api/vendor/products/delete-product.mdx +62 -0
- package/content/references/api/vendor/products/list-product-variants.mdx +114 -0
- package/content/references/api/vendor/products/list-products.mdx +163 -0
- package/content/references/api/vendor/products/preview-product.mdx +61 -0
- package/content/references/api/vendor/products/retrieve-product-variant.mdx +76 -0
- package/content/references/api/vendor/products/retrieve-product.mdx +69 -0
- package/content/references/api/vendor/products/update-product-variant.mdx +104 -0
- package/content/references/api/vendor/products/update-product.mdx +148 -0
- package/content/references/api/vendor/sellers/create-seller.mdx +150 -0
- package/content/references/api/vendor/sellers/delete-professional-details.mdx +54 -0
- package/content/references/api/vendor/sellers/invite-seller-member.mdx +67 -0
- package/content/references/api/vendor/sellers/list-member-invites.mdx +82 -0
- package/content/references/api/vendor/sellers/list-seller-members.mdx +80 -0
- package/content/references/api/vendor/sellers/list-sellers.mdx +71 -0
- package/content/references/api/vendor/sellers/remove-seller-member.mdx +48 -0
- package/content/references/api/vendor/sellers/retrieve-current-seller-member.mdx +59 -0
- package/content/references/api/vendor/sellers/retrieve-current-seller.mdx +69 -0
- package/content/references/api/vendor/sellers/select-seller.mdx +44 -0
- package/content/references/api/vendor/sellers/update-current-seller.mdx +108 -0
- package/content/references/api/vendor/sellers/update-member-role.mdx +51 -0
- package/content/references/api/vendor/sellers/upsert-payment-details.mdx +74 -0
- package/content/references/api/vendor/sellers/upsert-professional-details.mdx +70 -0
- package/content/references/api/vendor/sellers/upsert-seller-address.mdx +81 -0
- package/content/references/api/vendor.mdx +150 -0
- package/content/references/configuration.mdx +155 -0
- package/content/references/modules/commission.mdx +106 -0
- package/content/references/modules/custom-fields.mdx +45 -0
- package/content/references/modules/media.mdx +55 -0
- package/content/references/modules/offer.mdx +64 -0
- package/content/references/modules/payout.mdx +121 -0
- package/content/references/modules/product-attribute.mdx +111 -0
- package/content/references/modules/product-edit.mdx +80 -0
- package/content/references/modules/search.mdx +112 -0
- package/content/references/modules/seller.mdx +175 -0
- package/content/references/overview.mdx +70 -0
- package/content/references/workflows/cart/add-seller-shipping-method-to-cart.mdx +44 -0
- package/content/references/workflows/cart/complete-cart-with-split-orders.mdx +36 -0
- package/content/references/workflows/cart/list-seller-shipping-options-for-cart.mdx +39 -0
- package/content/references/workflows/cart/update-cart-seller-promotions.mdx +42 -0
- package/content/references/workflows/commission/batch-commission-rules.mdx +45 -0
- package/content/references/workflows/commission/create-commission-rates.mdx +41 -0
- package/content/references/workflows/commission/delete-commission-rates.mdx +34 -0
- package/content/references/workflows/commission/refresh-order-commission-lines.mdx +30 -0
- package/content/references/workflows/commission/update-commission-rates.mdx +35 -0
- package/content/references/workflows/media/set-category-images.mdx +41 -0
- package/content/references/workflows/media/set-collection-images.mdx +41 -0
- package/content/references/workflows/member/accept-member-invite.mdx +33 -0
- package/content/references/workflows/member/add-seller-member.mdx +30 -0
- package/content/references/workflows/member/create-member-invites.mdx +34 -0
- package/content/references/workflows/member/delete-member-invite.mdx +24 -0
- package/content/references/workflows/member/remove-seller-member.mdx +28 -0
- package/content/references/workflows/member/resend-member-invite.mdx +28 -0
- package/content/references/workflows/member/update-member-role.mdx +28 -0
- package/content/references/workflows/member/update-member.mdx +35 -0
- package/content/references/workflows/offer/batch-offer-inventory-items.mdx +58 -0
- package/content/references/workflows/offer/create-offers.mdx +63 -0
- package/content/references/workflows/offer/delete-offers.mdx +35 -0
- package/content/references/workflows/offer/update-offers.mdx +51 -0
- package/content/references/workflows/order/cancel-order-fulfillment.mdx +34 -0
- package/content/references/workflows/order/confirm-claim-request.mdx +25 -0
- package/content/references/workflows/order/confirm-exchange-request.mdx +25 -0
- package/content/references/workflows/order/confirm-order-edit-request.mdx +25 -0
- package/content/references/workflows/order/confirm-return-receive.mdx +25 -0
- package/content/references/workflows/order/create-order-fulfillment.mdx +45 -0
- package/content/references/workflows/order-group/get-order-group-detail.mdx +29 -0
- package/content/references/workflows/order-group/get-order-groups-list.mdx +36 -0
- package/content/references/workflows/overview.mdx +72 -0
- package/content/references/workflows/payout/create-onboarding.mdx +36 -0
- package/content/references/workflows/payout/create-payout-account.mdx +33 -0
- package/content/references/workflows/payout/create-payout.mdx +30 -0
- package/content/references/workflows/payout/process-payout-for-webhook.mdx +32 -0
- package/content/references/workflows/product/confirm-products.mdx +46 -0
- package/content/references/workflows/product/create-products.mdx +63 -0
- package/content/references/workflows/product/link-sellers-to-product-category.mdx +40 -0
- package/content/references/workflows/product/link-sellers-to-product.mdx +40 -0
- package/content/references/workflows/product/reject-product.mdx +46 -0
- package/content/references/workflows/product/request-product-change.mdx +46 -0
- package/content/references/workflows/product-attribute/add-product-attributes-to-product.mdx +49 -0
- package/content/references/workflows/product-attribute/create-and-link-product-attributes-to-product.mdx +46 -0
- package/content/references/workflows/product-attribute/create-product-attribute-values.mdx +43 -0
- package/content/references/workflows/product-attribute/create-product-attributes.mdx +56 -0
- package/content/references/workflows/product-attribute/delete-product-attribute-values.mdx +30 -0
- package/content/references/workflows/product-attribute/delete-product-attributes.mdx +30 -0
- package/content/references/workflows/product-attribute/remove-product-attributes-from-product.mdx +29 -0
- package/content/references/workflows/product-attribute/update-product-attribute-values.mdx +44 -0
- package/content/references/workflows/product-attribute/update-product-attributes-on-product.mdx +41 -0
- package/content/references/workflows/product-attribute/update-product-attributes.mdx +48 -0
- package/content/references/workflows/product-attribute/upsert-product-attribute-values.mdx +43 -0
- package/content/references/workflows/product-edit/auto-confirm-product-change.mdx +39 -0
- package/content/references/workflows/product-edit/cancel-product-change.mdx +49 -0
- package/content/references/workflows/product-edit/confirm-product-change.mdx +57 -0
- package/content/references/workflows/product-edit/create-product-change.mdx +72 -0
- package/content/references/workflows/product-edit/reject-product-change.mdx +54 -0
- package/content/references/workflows/product-edit/stage-product-change.mdx +75 -0
- package/content/references/workflows/seller/approve-seller.mdx +34 -0
- package/content/references/workflows/seller/create-seller-account.mdx +59 -0
- package/content/references/workflows/seller/create-seller-defaults.mdx +22 -0
- package/content/references/workflows/seller/create-sellers.mdx +65 -0
- package/content/references/workflows/seller/delete-seller-professional-details.mdx +37 -0
- package/content/references/workflows/seller/delete-sellers.mdx +24 -0
- package/content/references/workflows/seller/invite-seller.mdx +28 -0
- package/content/references/workflows/seller/suspend-seller.mdx +35 -0
- package/content/references/workflows/seller/terminate-seller.mdx +35 -0
- package/content/references/workflows/seller/unsuspend-seller.mdx +34 -0
- package/content/references/workflows/seller/unterminate-seller.mdx +34 -0
- package/content/references/workflows/seller/update-seller-address.mdx +55 -0
- package/content/references/workflows/seller/update-seller-payment-details.mdx +52 -0
- package/content/references/workflows/seller/update-seller-professional-details.mdx +48 -0
- package/content/references/workflows/seller/update-sellers.mdx +57 -0
- package/content/resources/ai/llms.mdx +74 -0
- package/content/resources/ai/mcp.mdx +152 -0
- package/content/resources/ai/overview.mdx +97 -0
- package/content/resources/customization/custom-fields.mdx +182 -0
- package/content/resources/customization/extend-a-workflow.mdx +39 -0
- package/content/resources/customization/extending-panels.mdx +309 -0
- package/content/resources/deployment/medusa-cloud.mdx +167 -0
- package/content/resources/integrations/notifications.mdx +39 -0
- package/content/resources/integrations/search.mdx +122 -0
- package/content/resources/integrations/stripe-connect.mdx +395 -0
- package/content/resources/tutorials/add-a-block.mdx +74 -0
- package/content/resources/tutorials/attributes-and-variant-axes.mdx +111 -0
- package/content/resources/tutorials/build-a-block.mdx +134 -0
- package/content/resources/tutorials/configure-commissions.mdx +127 -0
- package/content/resources/tutorials/custom-api-route.mdx +142 -0
- package/content/resources/tutorials/custom-panel-page.mdx +78 -0
- package/content/resources/tutorials/first-marketplace.mdx +45 -0
- package/content/resources/tutorials/handle-product-requests.mdx +80 -0
- package/content/resources/tutorials/import-export-products.mdx +96 -0
- package/content/resources/tutorials/master-products-and-offers.mdx +89 -0
- package/content/resources/tutorials/recompose-a-page.mdx +129 -0
- package/content/resources/tutorials/replace-panel-components.mdx +116 -0
- package/content/resources/tutorials/seller-payouts-stripe.mdx +89 -0
- package/content/telemetry.mdx +67 -0
- package/content/tools/api-client.mdx +155 -0
- package/content/tools/cli.mdx +196 -0
- package/content/tools/dashboard-sdk.mdx +35 -0
- package/content/user-guide/admin/overview.mdx +23 -0
- package/content/user-guide/admin/stores.mdx +193 -0
- package/content/user-guide/vendor/overview.mdx +23 -0
- package/content/user-guide/vendor/stores.mdx +209 -0
- package/llms.txt +307 -0
- package/package.json +33 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: From 1.x to 2.0
|
|
3
|
+
description: What changed and how to port your existing Mercur 1.x code to 2.0.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migrating from 1.x to 2.0
|
|
7
|
+
|
|
8
|
+
Start with a working 2.0 project (see [Installation](/rc/learn/installation)). This guide covers what to change when porting your 1.x code.
|
|
9
|
+
|
|
10
|
+
<Note>
|
|
11
|
+
**Using version older than 1.4.0?** Your admin panel code is inside the backend repo (not a separate app). When scanning for custom admin code to port, look there instead of `apps/admin/`. Everything else in this guide applies identically.
|
|
12
|
+
</Note>
|
|
13
|
+
|
|
14
|
+
## Package Mapping
|
|
15
|
+
|
|
16
|
+
| 1.x Package | 2.0 Equivalent |
|
|
17
|
+
|-------------|----------------|
|
|
18
|
+
| `@mercurjs/b2c-core` | `@mercurjs/core` |
|
|
19
|
+
| `@mercurjs/commission` | Built into core |
|
|
20
|
+
| `@mercurjs/algolia` | Block: `mercurjs add algolia` |
|
|
21
|
+
| `@mercurjs/resend` | No 2.0 equivalent — port manually |
|
|
22
|
+
| `@mercurjs/payment-stripe-connect` | No 2.0 equivalent — port manually |
|
|
23
|
+
| `@mercurjs/stripe-tax-provider` | No 2.0 equivalent — port manually |
|
|
24
|
+
| `@medusajs/admin-vite-plugin` | `@mercurjs/dashboard-sdk` |
|
|
25
|
+
| `@medusajs/js-sdk` | `@mercurjs/client` |
|
|
26
|
+
|
|
27
|
+
## Directory Mapping
|
|
28
|
+
|
|
29
|
+
| 1.x | 2.0 |
|
|
30
|
+
|-----|-----|
|
|
31
|
+
| `apps/backend/src/*` | `packages/api/src/*` |
|
|
32
|
+
| `apps/admin/src/routes/` | `apps/admin/src/pages/` |
|
|
33
|
+
| `apps/vendor/src/routes/` | `apps/vendor/src/pages/` |
|
|
34
|
+
|
|
35
|
+
## What You DON'T Need to Port
|
|
36
|
+
|
|
37
|
+
Built into core today:
|
|
38
|
+
|
|
39
|
+
- `seller`
|
|
40
|
+
- `payout`
|
|
41
|
+
- `commission`
|
|
42
|
+
|
|
43
|
+
Moved to registry blocks:
|
|
44
|
+
|
|
45
|
+
- `reviews`
|
|
46
|
+
- `requests`
|
|
47
|
+
- `wishlist`
|
|
48
|
+
- `team-management`
|
|
49
|
+
- `algolia`
|
|
50
|
+
- `vendor-notifications`
|
|
51
|
+
- `vendor-chat`
|
|
52
|
+
- `product-import-export`
|
|
53
|
+
|
|
54
|
+
Install these blocks instead of porting their 1.x package code.
|
|
55
|
+
|
|
56
|
+
## Current Migration Exceptions
|
|
57
|
+
|
|
58
|
+
These areas do not currently have full 1.x parity and should be treated as manual migration work:
|
|
59
|
+
|
|
60
|
+
- **`TaxCode`** — no 2.0 equivalent today. Port the old logic manually if your project depends on it.
|
|
61
|
+
- **`SecondaryCategory`** — no full 1.x parity today. Port manually for now if your project depends on it. Fuller support is planned for a future 2.x release.
|
|
62
|
+
- **Product attributes** — the 1.x attribute module is not carried over 1:1. Port manually for now if your project depends on it. Fuller support is planned for a future 2.x release.
|
|
63
|
+
|
|
64
|
+
## Order Set to Order Group
|
|
65
|
+
|
|
66
|
+
The 1.x `OrderSet` entity has been renamed to **`OrderGroup`** in 2.0. This is a breaking change that affects database tables, API endpoints, workflow names, event names, and types.
|
|
67
|
+
|
|
68
|
+
### What changed
|
|
69
|
+
|
|
70
|
+
| Aspect | 1.x | 2.0 |
|
|
71
|
+
|--------|-----|-----|
|
|
72
|
+
| Entity / table | `order_set` | `order_group` |
|
|
73
|
+
| ID prefix | `os_` | `og_` |
|
|
74
|
+
| API endpoints | `/admin/order-sets`, `/store/order-set` | `/admin/order-groups`, `/store/order-groups` |
|
|
75
|
+
| Workflows | `getFormattedOrderSetListWorkflow` | `getOrderGroupsListWorkflow`, `getOrderGroupDetailWorkflow` |
|
|
76
|
+
| Events | `OrderSetWorkflowEvents` | `OrderGroupWorkflowEvents` |
|
|
77
|
+
| Types | `OrderSetDTO` | `OrderGroupDTO` (from `@mercurjs/types`) |
|
|
78
|
+
|
|
79
|
+
### Removed fields
|
|
80
|
+
|
|
81
|
+
Two fields that existed on `OrderSet` in 1.x have been **removed** from `OrderGroup`:
|
|
82
|
+
|
|
83
|
+
- **`payment_collection_id`** — Payment collections are now linked at the individual **order** level, not at the group level. Each per-seller order gets its own link to the cart's payment collection during checkout. To get the payment collection, query the linked orders instead of the group.
|
|
84
|
+
- **`sales_channel_id`** — Sales channel information is stored on each individual order, not on the group.
|
|
85
|
+
|
|
86
|
+
### New computed fields
|
|
87
|
+
|
|
88
|
+
Two fields are now **computed at query time** (not stored as columns):
|
|
89
|
+
|
|
90
|
+
- **`seller_count`** — Count of distinct sellers across all linked orders
|
|
91
|
+
- **`total`** — Sum of order totals from linked order summaries
|
|
92
|
+
|
|
93
|
+
### Migration steps
|
|
94
|
+
|
|
95
|
+
1. Update imports: `OrderSetDTO` → `OrderGroupDTO` (from `@mercurjs/types`)
|
|
96
|
+
2. Update API calls: `/order-sets` → `/order-groups`
|
|
97
|
+
3. Update workflow references: `getFormattedOrderSetListWorkflow` → `getOrderGroupsListWorkflow`
|
|
98
|
+
4. Update event listeners: `OrderSetWorkflowEvents` → `OrderGroupWorkflowEvents`
|
|
99
|
+
5. If you used `payment_collection_id` or `sales_channel_id` from the order set, retrieve these from the individual orders instead (via the `order_group_order` link)
|
|
100
|
+
|
|
101
|
+
See [Order Groups](/rc/learn/order-groups) for the full 2.0 data model and API reference.
|
|
102
|
+
|
|
103
|
+
## Porting Custom Backend Code
|
|
104
|
+
|
|
105
|
+
### Modules
|
|
106
|
+
|
|
107
|
+
Copy to `packages/api/src/modules/`, register in `medusa-config.ts`. Update imports from `@mercurjs/b2c-core` to `@mercurjs/core`.
|
|
108
|
+
|
|
109
|
+
### Workflows
|
|
110
|
+
|
|
111
|
+
Copy to `packages/api/src/workflows/<entity>/`. Don't create barrel `index.ts` files — conflicts with block installation.
|
|
112
|
+
|
|
113
|
+
### API Routes
|
|
114
|
+
|
|
115
|
+
Copy to `packages/api/src/api/`. Type both generics — codegen reads these:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
export const GET = async (
|
|
119
|
+
req: AuthenticatedMedusaRequest<BodyType>,
|
|
120
|
+
res: MedusaResponse<ResponseType>
|
|
121
|
+
) => { ... }
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Run `bunx @mercurjs/cli@rc codegen` after adding routes.
|
|
125
|
+
|
|
126
|
+
### Links and Subscribers
|
|
127
|
+
|
|
128
|
+
Copy to `packages/api/src/links/` and `src/subscribers/`. Don't duplicate links that core already provides (seller↔product, seller↔order, etc.).
|
|
129
|
+
|
|
130
|
+
### Custom Providers
|
|
131
|
+
|
|
132
|
+
Copy to `packages/api/src/providers/`. Two required changes:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// medusa-config.ts — must use ./src/ prefix
|
|
136
|
+
resolve: './src/providers/my-provider'
|
|
137
|
+
|
|
138
|
+
// provider index.ts — must import from framework/utils
|
|
139
|
+
import { Modules, ModuleProvider } from "@medusajs/framework/utils"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Porting Custom Dashboard Code
|
|
143
|
+
|
|
144
|
+
Only if you have custom pages not covered by core-admin/vendor.
|
|
145
|
+
|
|
146
|
+
| Old import | New import |
|
|
147
|
+
|-----------|------------|
|
|
148
|
+
| `@medusajs/js-sdk` | `@mercurjs/client` |
|
|
149
|
+
| `@custom-types/*` | `@mercurjs/types` |
|
|
150
|
+
| `@hooks/*`, `@components/*`, `@lib/*` | Keep local, or `@mercurjs/dashboard-shared` if the symbol exists there |
|
|
151
|
+
|
|
152
|
+
Move pages from `src/routes/` to `src/pages/` with `export default`.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: From 2.0 to 2.1
|
|
3
|
+
description: What changed in Mercur 2.1 and how to upgrade an existing 2.0.x project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migrating from 2.0 to 2.1
|
|
7
|
+
|
|
8
|
+
Mercur `2.1.1` is the first stable release of the 2.x line after `2.0.2`. The only required change is a package rename. Everything else is handled by `bun run medusa db:migrate`.
|
|
9
|
+
|
|
10
|
+
If you are starting fresh, follow [Installation](/rc/learn/installation) instead — new projects already use the 2.1 names.
|
|
11
|
+
|
|
12
|
+
## Breaking change: `@mercurjs/core-plugin` → `@mercurjs/core`
|
|
13
|
+
|
|
14
|
+
The Medusa plugin previously published as `@mercurjs/core-plugin` is now published as **`@mercurjs/core`**. The package contents are the same; only the name changed.
|
|
15
|
+
|
|
16
|
+
This affects:
|
|
17
|
+
|
|
18
|
+
- `package.json` — installed package name
|
|
19
|
+
- `medusa-config.ts` — every `resolve: "@mercurjs/core-plugin/..."` value
|
|
20
|
+
- Any source imports in `packages/api/src/**`
|
|
21
|
+
|
|
22
|
+
### Step 1 — swap the dependency
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bun remove @mercurjs/core-plugin
|
|
26
|
+
bun add @mercurjs/core@2.1.1
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If you use npm/yarn/pnpm, use the equivalent commands for your package manager.
|
|
30
|
+
|
|
31
|
+
Or edit `packages/api/package.json` by hand — replace the `@mercurjs/core-plugin` entry under `dependencies` with `@mercurjs/core` at the matching version, then run your installer:
|
|
32
|
+
|
|
33
|
+
```jsonc
|
|
34
|
+
// before
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@mercurjs/core-plugin": "2.0.2"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// after
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@mercurjs/core": "2.1.1"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bun install
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Step 2 — replace strings in config and source
|
|
50
|
+
|
|
51
|
+
In `packages/api/medusa-config.ts` and anywhere under `packages/api/src/**`, replace every occurrence of `@mercurjs/core-plugin` with `@mercurjs/core`. A repo-wide find-and-replace is safe — there are no other valid uses of the old name.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// before
|
|
55
|
+
{
|
|
56
|
+
resolve: "@mercurjs/core-plugin/modules/seller",
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// after
|
|
60
|
+
{
|
|
61
|
+
resolve: "@mercurjs/core/modules/seller",
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
// before
|
|
67
|
+
import { createSellerWorkflow } from "@mercurjs/core-plugin/workflows"
|
|
68
|
+
|
|
69
|
+
// after
|
|
70
|
+
import { createSellerWorkflow } from "@mercurjs/core/workflows"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The same applies to:
|
|
74
|
+
|
|
75
|
+
- `@mercurjs/core-plugin/modules/<module>`
|
|
76
|
+
- `@mercurjs/core-plugin/workflows`
|
|
77
|
+
- `@mercurjs/core-plugin/links`
|
|
78
|
+
- `@mercurjs/core-plugin/api`
|
|
79
|
+
|
|
80
|
+
### Step 3 — reinstall and rebuild
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
bun install
|
|
84
|
+
bun run build
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If TypeScript still complains about `@mercurjs/core-plugin`, you missed an import. Re-run the find-and-replace.
|
|
88
|
+
|
|
89
|
+
### Step 4 — refresh installed blocks
|
|
90
|
+
|
|
91
|
+
If your project installed registry blocks (`mercurjs add reviews`, `mercurjs add requests`, etc.) on a 2.0.x version, the local copies still reference `@mercurjs/core-plugin`. Either:
|
|
92
|
+
|
|
93
|
+
- Run the same find-and-replace inside `packages/api/src/` (registry blocks live there once installed)
|
|
94
|
+
|
|
95
|
+
## Database migrations
|
|
96
|
+
|
|
97
|
+
Mercur 2.1 ships several new migrations on the `seller` module. All are non-destructive. Run:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
bun run medusa db:migrate
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Full changelog
|
|
104
|
+
|
|
105
|
+
The complete 2.1 changelog is published with the [GitHub release](https://github.com/mercurjs/mercur/releases/tag/v2.1.1).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migration Overview
|
|
3
|
+
description: Understand what changes between Mercur 1.x and 2.0 and how to migrate your project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migration Overview
|
|
7
|
+
|
|
8
|
+
Mercur 2.0 replaces the monolithic plugin architecture (`@mercurjs/b2c-core`) with a block-based model (`@mercurjs/core` + registry blocks).
|
|
9
|
+
|
|
10
|
+
This guide is about **porting your existing 1.x code to a 2.0 project**. For setting up a fresh 2.0 project, see [Installation](/rc/learn/installation).
|
|
11
|
+
|
|
12
|
+
<Tip>
|
|
13
|
+
If you're using an AI Agent/IDE (Claude Code, Cursor, or similar), your project includes a `migration-guide` skill that can analyze your 1.x Mercur project and walk you through the migration step by step.
|
|
14
|
+
</Tip>
|
|
15
|
+
|
|
16
|
+
## What Replaced What
|
|
17
|
+
|
|
18
|
+
| 1.x | 2.0 |
|
|
19
|
+
|-------|--------|
|
|
20
|
+
| `@mercurjs/b2c-core` (monolithic) | `@mercurjs/core` — all core modules built in |
|
|
21
|
+
| `@mercurjs/commission` (separate) | Built into core |
|
|
22
|
+
| `@mercurjs/algolia`, reviews, requests | Registry blocks (`mercurjs add ...`) |
|
|
23
|
+
| `@medusajs/admin-vite-plugin` | `@mercurjs/dashboard-sdk` (virtual modules) |
|
|
24
|
+
| `@medusajs/js-sdk` (manual hooks) | `@mercurjs/client` (generated typed client) |
|
|
25
|
+
| Custom admin/vendor pages | `@mercurjs/admin` / `@mercurjs/vendor` — complete panels out of the box |
|
|
26
|
+
| `apps/backend/` | `packages/api/` |
|
|
27
|
+
| `src/routes/` (admin) | `src/pages/` (file-based routing) |
|
|
28
|
+
| Yarn + Turbo | bun (recommended) |
|
|
29
|
+
|
|
30
|
+
## What Didn't Change
|
|
31
|
+
|
|
32
|
+
- MedusaJS v2 foundation (modules, workflows, links, subscribers, API routes)
|
|
33
|
+
- Data model patterns (MikroORM, service layer)
|
|
34
|
+
- Environment variables (`DATABASE_URL`, CORS, secrets — all the same)
|
|
35
|
+
|
|
36
|
+
## What You Need to Migrate
|
|
37
|
+
|
|
38
|
+
**Most users don't need to migrate much.** Core-plugin and the official registry blocks cover most standard marketplace functionality. Core-admin/vendor panels provide 34+ pages out of the box.
|
|
39
|
+
|
|
40
|
+
You only need to port:
|
|
41
|
+
- **Custom modules** — business-specific modules not covered by core or blocks
|
|
42
|
+
- **Custom workflows and routes** — your own endpoints and business logic
|
|
43
|
+
- **Custom dashboard pages** — only if you have domain-specific pages not in core-admin/vendor
|
|
44
|
+
|
|
45
|
+
<Warning>
|
|
46
|
+
Current migration exceptions:
|
|
47
|
+
|
|
48
|
+
- `TaxCode` does not have a 2.0 equivalent today and requires manual migration.
|
|
49
|
+
- `SecondaryCategory` does not yet have full 1.x parity and may require manual migration for now.
|
|
50
|
+
- The 1.x product attribute system is not carried over 1:1, so product attributes may require manual migration for now.
|
|
51
|
+
|
|
52
|
+
See [From 1.x to 2.0](/migrations/from-1-x-to-2-0) for the full migration guidance and current status.
|
|
53
|
+
</Warning>
|
|
54
|
+
|
|
55
|
+
## Next Steps
|
|
56
|
+
|
|
57
|
+
- [From 2.0 to 2.1](/migrations/from-2-0-to-2-1) — package rename (`@mercurjs/core-plugin` → `@mercurjs/core`) and a `db:migrate` step
|
|
58
|
+
- [From 1.x to 2.0](/migrations/from-1-x-to-2-0) — full guide for porting an existing 1.x project
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Batch Commission Rules"
|
|
3
|
+
api: "POST /admin/commission-rates/{id}/rules"
|
|
4
|
+
description: "Create, update, and delete a commission rate's rules in one request."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Applies a batch of rule operations against a commission rate.
|
|
8
|
+
|
|
9
|
+
## Path parameters
|
|
10
|
+
|
|
11
|
+
<ParamField path="id" type="string" required>The commission rate's ID.</ParamField>
|
|
12
|
+
|
|
13
|
+
## Body parameters
|
|
14
|
+
|
|
15
|
+
<ParamField body="create" type="object[]">
|
|
16
|
+
Rules to create.
|
|
17
|
+
<Expandable title="properties">
|
|
18
|
+
<ParamField body="reference" type="string" required>The rule target type: `product`, `product_type`, `product_collection`, `product_category`, or `seller`.</ParamField>
|
|
19
|
+
<ParamField body="reference_id" type="string" required>ID of the referenced entity.</ParamField>
|
|
20
|
+
</Expandable>
|
|
21
|
+
</ParamField>
|
|
22
|
+
<ParamField body="update" type="object[]">
|
|
23
|
+
Rules to update.
|
|
24
|
+
<Expandable title="properties">
|
|
25
|
+
<ParamField body="id" type="string" required>The rule's ID.</ParamField>
|
|
26
|
+
<ParamField body="reference" type="string">The rule target type: `product`, `product_type`, `product_collection`, `product_category`, or `seller`.</ParamField>
|
|
27
|
+
<ParamField body="reference_id" type="string">ID of the referenced entity.</ParamField>
|
|
28
|
+
</Expandable>
|
|
29
|
+
</ParamField>
|
|
30
|
+
<ParamField body="delete" type="string[]">IDs of rules to delete.</ParamField>
|
|
31
|
+
|
|
32
|
+
## Response
|
|
33
|
+
|
|
34
|
+
<ResponseField name="created" type="object[]">The created rules.</ResponseField>
|
|
35
|
+
<ResponseField name="updated" type="object[]">The updated rules.</ResponseField>
|
|
36
|
+
<ResponseField name="deleted" type="string[]">IDs of the deleted rules.</ResponseField>
|
|
37
|
+
|
|
38
|
+
<RequestExample>
|
|
39
|
+
```bash cURL
|
|
40
|
+
curl -X POST 'http://localhost:9000/admin/commission-rates/comrate_01HXYZ8Q2M4N6P8R0T2V4W6X8Y/rules' \
|
|
41
|
+
-H 'Authorization: Bearer <token>' \
|
|
42
|
+
-H 'Content-Type: application/json' \
|
|
43
|
+
-d '{"create": [{"reference": "seller", "reference_id": "sel_01HXYZ"}], "delete": ["comrule_01HABC"]}'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```ts JS Client
|
|
47
|
+
const { created, updated, deleted } =
|
|
48
|
+
await client.admin.commissionRates.$id.rules.mutate({
|
|
49
|
+
$id: "comrate_01HXYZ8Q2M4N6P8R0T2V4W6X8Y",
|
|
50
|
+
create: [{ reference: "seller", reference_id: "sel_01HXYZ" }],
|
|
51
|
+
delete: ["comrule_01HABC"],
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
</RequestExample>
|
|
55
|
+
|
|
56
|
+
<ResponseExample>
|
|
57
|
+
```json 200
|
|
58
|
+
{
|
|
59
|
+
"created": [
|
|
60
|
+
{
|
|
61
|
+
"id": "comrule_01HXYZ9A1B2C3D4E5F6G7H8J9K",
|
|
62
|
+
"reference": "seller",
|
|
63
|
+
"reference_id": "sel_01HXYZ"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"updated": [],
|
|
67
|
+
"deleted": ["comrule_01HABC"]
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
</ResponseExample>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Create Commission Rate"
|
|
3
|
+
api: "POST /admin/commission-rates"
|
|
4
|
+
description: "Create a commission rate."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Creates a commission rate, optionally with scoping rules and per-currency values.
|
|
8
|
+
|
|
9
|
+
## Body parameters
|
|
10
|
+
|
|
11
|
+
<ParamField body="name" type="string" required>The rate's display name.</ParamField>
|
|
12
|
+
<ParamField body="code" type="string" required>Unique code identifying the rate.</ParamField>
|
|
13
|
+
<ParamField body="type" type="string" required>The rate type: `fixed` or `percentage`.</ParamField>
|
|
14
|
+
<ParamField body="value" type="number" required>The commission value — a percentage or a fixed amount.</ParamField>
|
|
15
|
+
<ParamField body="currency_code" type="string">Currency of a fixed rate's value.</ParamField>
|
|
16
|
+
<ParamField body="include_tax" type="boolean">Whether commission is calculated on tax-inclusive amounts.</ParamField>
|
|
17
|
+
<ParamField body="include_shipping" type="boolean">Whether shipping is included in the commission base.</ParamField>
|
|
18
|
+
<ParamField body="is_enabled" type="boolean">Whether the rate is active.</ParamField>
|
|
19
|
+
<ParamField body="is_default" type="boolean">Whether this is the marketplace default rate.</ParamField>
|
|
20
|
+
<ParamField body="rules" type="object[]">
|
|
21
|
+
Rules scoping which sellers or products the rate applies to.
|
|
22
|
+
<Expandable title="properties">
|
|
23
|
+
<ParamField body="reference" type="string" required>The rule target type: `product`, `product_type`, `product_collection`, `product_category`, or `seller`.</ParamField>
|
|
24
|
+
<ParamField body="reference_id" type="string" required>ID of the referenced entity.</ParamField>
|
|
25
|
+
</Expandable>
|
|
26
|
+
</ParamField>
|
|
27
|
+
<ParamField body="values" type="object[]">
|
|
28
|
+
Per-currency fixed amounts.
|
|
29
|
+
<Expandable title="properties">
|
|
30
|
+
<ParamField body="currency_code" type="string" required>The value's currency code.</ParamField>
|
|
31
|
+
<ParamField body="amount" type="number" required>The fixed commission amount for that currency.</ParamField>
|
|
32
|
+
</Expandable>
|
|
33
|
+
</ParamField>
|
|
34
|
+
|
|
35
|
+
## Response
|
|
36
|
+
|
|
37
|
+
<ResponseField name="commission_rate" type="object">
|
|
38
|
+
<Expandable title="properties">
|
|
39
|
+
<ResponseField name="id" type="string">The commission rate's ID.</ResponseField>
|
|
40
|
+
<ResponseField name="name" type="string">The rate's display name.</ResponseField>
|
|
41
|
+
<ResponseField name="code" type="string">The rate's unique code.</ResponseField>
|
|
42
|
+
<ResponseField name="type" type="string">The rate type: `fixed` or `percentage`.</ResponseField>
|
|
43
|
+
<ResponseField name="value" type="number">The commission value.</ResponseField>
|
|
44
|
+
<ResponseField name="is_enabled" type="boolean">Whether the rate is active.</ResponseField>
|
|
45
|
+
<ResponseField name="is_default" type="boolean">Whether this is the marketplace default rate.</ResponseField>
|
|
46
|
+
<ResponseField name="rules" type="object[]">Rules scoping the rate.</ResponseField>
|
|
47
|
+
<ResponseField name="values" type="object[]">Per-currency fixed amounts.</ResponseField>
|
|
48
|
+
</Expandable>
|
|
49
|
+
</ResponseField>
|
|
50
|
+
|
|
51
|
+
<RequestExample>
|
|
52
|
+
```bash cURL
|
|
53
|
+
curl -X POST 'http://localhost:9000/admin/commission-rates' \
|
|
54
|
+
-H 'Authorization: Bearer <token>' \
|
|
55
|
+
-H 'Content-Type: application/json' \
|
|
56
|
+
-d '{"name": "Electronics", "code": "electronics", "type": "percentage", "value": 12, "rules": [{"reference": "product_category", "reference_id": "pcat_01HXYZ"}]}'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```ts JS Client
|
|
60
|
+
const { commission_rate } = await client.admin.commissionRates.mutate({
|
|
61
|
+
name: "Electronics",
|
|
62
|
+
code: "electronics",
|
|
63
|
+
type: "percentage",
|
|
64
|
+
value: 12,
|
|
65
|
+
rules: [{ reference: "product_category", reference_id: "pcat_01HXYZ" }],
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
</RequestExample>
|
|
69
|
+
|
|
70
|
+
<ResponseExample>
|
|
71
|
+
```json 201
|
|
72
|
+
{
|
|
73
|
+
"commission_rate": {
|
|
74
|
+
"id": "comrate_01HXYZ8Q2M4N6P8R0T2V4W6X8Y",
|
|
75
|
+
"name": "Electronics",
|
|
76
|
+
"code": "electronics",
|
|
77
|
+
"type": "percentage",
|
|
78
|
+
"value": 12,
|
|
79
|
+
"currency_code": null,
|
|
80
|
+
"include_tax": false,
|
|
81
|
+
"include_shipping": false,
|
|
82
|
+
"is_enabled": true,
|
|
83
|
+
"is_default": false,
|
|
84
|
+
"rules": [
|
|
85
|
+
{
|
|
86
|
+
"id": "comrule_01HXYZ9A1B2C3D4E5F6G7H8J9K",
|
|
87
|
+
"reference": "product_category",
|
|
88
|
+
"reference_id": "pcat_01HXYZ"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"values": []
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
</ResponseExample>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Delete Commission Rate"
|
|
3
|
+
api: "DELETE /admin/commission-rates/{id}"
|
|
4
|
+
description: "Delete a commission rate."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Deletes a commission rate and its rules.
|
|
8
|
+
|
|
9
|
+
## Path parameters
|
|
10
|
+
|
|
11
|
+
<ParamField path="id" type="string" required>The commission rate's ID.</ParamField>
|
|
12
|
+
|
|
13
|
+
## Response
|
|
14
|
+
|
|
15
|
+
<ResponseField name="id" type="string">The deleted commission rate's ID.</ResponseField>
|
|
16
|
+
<ResponseField name="object" type="string">The object type: `commission_rate`.</ResponseField>
|
|
17
|
+
<ResponseField name="deleted" type="boolean">Whether the rate was deleted.</ResponseField>
|
|
18
|
+
|
|
19
|
+
<RequestExample>
|
|
20
|
+
```bash cURL
|
|
21
|
+
curl -X DELETE 'http://localhost:9000/admin/commission-rates/comrate_01HXYZ8Q2M4N6P8R0T2V4W6X8Y' \
|
|
22
|
+
-H 'Authorization: Bearer <token>'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```ts JS Client
|
|
26
|
+
const result = await client.admin.commissionRates.$id.delete({
|
|
27
|
+
$id: "comrate_01HXYZ8Q2M4N6P8R0T2V4W6X8Y",
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
</RequestExample>
|
|
31
|
+
|
|
32
|
+
<ResponseExample>
|
|
33
|
+
```json 200
|
|
34
|
+
{
|
|
35
|
+
"id": "comrate_01HXYZ8Q2M4N6P8R0T2V4W6X8Y",
|
|
36
|
+
"object": "commission_rate",
|
|
37
|
+
"deleted": true
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
</ResponseExample>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "List Commission Rates"
|
|
3
|
+
api: "GET /admin/commission-rates"
|
|
4
|
+
description: "Retrieve a paginated list of commission rates."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Returns commission rates with their rules and currency-specific values.
|
|
8
|
+
|
|
9
|
+
<Note>
|
|
10
|
+
`scope_type` is a virtual filter derived from each rate's rules — it is not a
|
|
11
|
+
stored column. Use it to filter rates by the scope their rules target.
|
|
12
|
+
</Note>
|
|
13
|
+
|
|
14
|
+
## Query parameters
|
|
15
|
+
|
|
16
|
+
<ParamField query="limit" type="number" default="50">Maximum number of records to return.</ParamField>
|
|
17
|
+
<ParamField query="offset" type="number" default="0">Number of records to skip.</ParamField>
|
|
18
|
+
<ParamField query="order" type="string">Field to sort by, prefix with `-` for descending order.</ParamField>
|
|
19
|
+
<ParamField query="fields" type="string">Comma-separated fields to include in the response.</ParamField>
|
|
20
|
+
<ParamField query="q" type="string">Search term matched against commission rates.</ParamField>
|
|
21
|
+
<ParamField query="id" type="string | string[]">Filter by commission rate ID(s).</ParamField>
|
|
22
|
+
<ParamField query="code" type="string | string[]">Filter by commission rate code(s).</ParamField>
|
|
23
|
+
<ParamField query="type" type="string | string[]">Filter by rate type: `fixed` or `percentage`.</ParamField>
|
|
24
|
+
<ParamField query="scope_type" type="string | string[]">Filter by rule scope: `store`, `product_type`, `category`, `store_product_type`, or `store_category`.</ParamField>
|
|
25
|
+
<ParamField query="is_enabled" type="boolean">Filter by enabled state.</ParamField>
|
|
26
|
+
<ParamField query="is_default" type="boolean">Filter by whether the rate is the marketplace default.</ParamField>
|
|
27
|
+
<ParamField query="created_at" type="object">Filter by creation date using operators like `$gte` and `$lte`.</ParamField>
|
|
28
|
+
<ParamField query="updated_at" type="object">Filter by update date using operators like `$gte` and `$lte`.</ParamField>
|
|
29
|
+
|
|
30
|
+
## Response
|
|
31
|
+
|
|
32
|
+
<ResponseField name="commission_rates" type="object[]">
|
|
33
|
+
<Expandable title="properties">
|
|
34
|
+
<ResponseField name="id" type="string">The commission rate's ID.</ResponseField>
|
|
35
|
+
<ResponseField name="name" type="string">The rate's display name.</ResponseField>
|
|
36
|
+
<ResponseField name="code" type="string">The rate's unique code.</ResponseField>
|
|
37
|
+
<ResponseField name="type" type="string">The rate type: `fixed` or `percentage`.</ResponseField>
|
|
38
|
+
<ResponseField name="value" type="number">The commission value — a percentage or a fixed amount.</ResponseField>
|
|
39
|
+
<ResponseField name="currency_code" type="string | null">Currency of a fixed rate's value.</ResponseField>
|
|
40
|
+
<ResponseField name="include_tax" type="boolean">Whether commission is calculated on tax-inclusive amounts.</ResponseField>
|
|
41
|
+
<ResponseField name="include_shipping" type="boolean">Whether shipping is included in the commission base.</ResponseField>
|
|
42
|
+
<ResponseField name="is_enabled" type="boolean">Whether the rate is active.</ResponseField>
|
|
43
|
+
<ResponseField name="is_default" type="boolean">Whether this is the marketplace default rate.</ResponseField>
|
|
44
|
+
<ResponseField name="rules" type="object[]">Rules scoping the rate, each with `id`, `reference`, and `reference_id`.</ResponseField>
|
|
45
|
+
<ResponseField name="values" type="object[]">Per-currency fixed amounts, each with `id`, `currency_code`, and `amount`.</ResponseField>
|
|
46
|
+
<ResponseField name="created_at" type="string">Creation timestamp.</ResponseField>
|
|
47
|
+
<ResponseField name="updated_at" type="string">Last update timestamp.</ResponseField>
|
|
48
|
+
</Expandable>
|
|
49
|
+
</ResponseField>
|
|
50
|
+
<ResponseField name="count" type="number">Total number of matching commission rates.</ResponseField>
|
|
51
|
+
<ResponseField name="offset" type="number">Number of records skipped.</ResponseField>
|
|
52
|
+
<ResponseField name="limit" type="number">Maximum number of records returned.</ResponseField>
|
|
53
|
+
|
|
54
|
+
<RequestExample>
|
|
55
|
+
```bash cURL
|
|
56
|
+
curl 'http://localhost:9000/admin/commission-rates?scope_type=store&limit=20' \
|
|
57
|
+
-H 'Authorization: Bearer <token>'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```ts JS Client
|
|
61
|
+
const { commission_rates, count } = await client.admin.commissionRates.query({
|
|
62
|
+
scope_type: "store",
|
|
63
|
+
limit: 20,
|
|
64
|
+
})
|
|
65
|
+
```
|
|
66
|
+
</RequestExample>
|
|
67
|
+
|
|
68
|
+
<ResponseExample>
|
|
69
|
+
```json 200
|
|
70
|
+
{
|
|
71
|
+
"commission_rates": [
|
|
72
|
+
{
|
|
73
|
+
"id": "comrate_01HXYZ8Q2M4N6P8R0T2V4W6X8Y",
|
|
74
|
+
"name": "Default",
|
|
75
|
+
"code": "default",
|
|
76
|
+
"type": "percentage",
|
|
77
|
+
"value": 10,
|
|
78
|
+
"currency_code": null,
|
|
79
|
+
"include_tax": false,
|
|
80
|
+
"include_shipping": false,
|
|
81
|
+
"is_enabled": true,
|
|
82
|
+
"is_default": true,
|
|
83
|
+
"rules": [],
|
|
84
|
+
"values": []
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"count": 1,
|
|
88
|
+
"offset": 0,
|
|
89
|
+
"limit": 20
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
</ResponseExample>
|