{"id":28828961,"url":"https://github.com/forcedotcom/commerce-extensibility","last_synced_at":"2026-02-25T09:33:07.868Z","repository":{"id":183535340,"uuid":"612334609","full_name":"forcedotcom/commerce-extensibility","owner":"forcedotcom","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-27T11:11:06.000Z","size":436,"stargazers_count":32,"open_issues_count":7,"forks_count":27,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-02-15T17:40:42.987Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Apex","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forcedotcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-10T17:58:39.000Z","updated_at":"2026-01-27T11:11:11.000Z","dependencies_parsed_at":"2024-02-19T16:48:25.448Z","dependency_job_id":"c2bc882a-07db-4656-92e6-5be99ac0dbe3","html_url":"https://github.com/forcedotcom/commerce-extensibility","commit_stats":null,"previous_names":["forcedotcom/commerce-extensibility"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/forcedotcom/commerce-extensibility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fcommerce-extensibility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fcommerce-extensibility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fcommerce-extensibility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fcommerce-extensibility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forcedotcom","download_url":"https://codeload.github.com/forcedotcom/commerce-extensibility/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcedotcom%2Fcommerce-extensibility/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29816074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T05:36:42.804Z","status":"ssl_error","status_checked_at":"2026-02-25T05:36:31.934Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-19T05:11:06.589Z","updated_at":"2026-02-25T09:33:07.862Z","avatar_url":"https://github.com/forcedotcom.png","language":"Apex","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Commerce Extensibility\n\nThis repository contains a reference implementation of the Commerce Extensibility Framework. It includes sample code for extending the following services:\n\n- [Domain Extensions for Cart Calculate API](#domain-extensions-for-cart-calculate-api):\n\t- Pricing\n    - Promotion\n\t- Shipping Calculator\n\t- Tax Calculator\n\t- Tax Service\n- [Domain Extensions for Checkout](#domain-extensions-for-checkout)\n\t- CreateOrder Service\n\t- SplitShipment Service\n- [Domain Extensions for Buyer Group](#domain-extensions-for-buyer-group)\n\t- Buyer Group Extensibility Service\n\nEach set of sample code includes: an Apex class, a test class, and any necessary resource files.\n\nLive Heroku services are used to simulate a connection to a third-party system. You can bypass the Heroku service and use mocked data instead.\n\n**Warning**: The sample code and Heroku services are provided \"as is\" for demonstration purposes only. Do not use the source code in a production system without modifying and testing it first. And do not use the Heroku services in a production system under any circumstances.\n\n## Domain Extensions for Cart Calculate API\n\n### Pricing Service\n\nThe sample code for Pricing Service includes an Apex class (in `PricingServiceSample.apxc`) that calls an external service to retrieve product prices and then saves that price in the `PricingResponseItems` list.\n\n### Pricing Calculator\n\nThe sample code for Pricing Calculator includes an Apex class (in `PricingCalculatorSample.apxc`) that calls an external service to retrieve pricing information and then save those taxes in `CartItem`.\n\n### Promotion Calculator\n\nThe sample code for Promotion Calculator includes an Apex class (in `PromotionCalculatorSample.apxc`) that updates price adjustments for each `CartItem` based on promotion applied.\n\n### Shipping Calculator\n\nThe sample code for Shipping Calculator includes an Apex class (in `ShippingCalculatorSample.apxc`) that calls an external service to retrieve shipping rates and then save that rate as an additional charge in the `CartItems` list.\n\n### Tax Calculator\n\nThe sample code for Tax Calculator includes an Apex class (in `TaxCalculatorSample.apxc`) that calls an external service to retrieve tax information and then save those taxes in `CartTaxes` in `CartItems`.\n\n### Tax Service\n\nThe sample code for Tax Service includes the following Apex classes :\n- an Apex class (in `TaxServiceSample.apxc`) that calls an external service to retrieve tax calculation data and then saves that in the `CalculateTaxesResponseLineItem` list.\n- an Apex class (in `TaxServiceExtensionResolverSample.apxc`) which selects different resolution states (EXECUTE_DEFAULT, EXECUTE_REGISTERED and OFF) for different locales to execute respective implementations (Extension Providers or the Default Salesforce Internal Tax Api).\n\n### Error Handling\n\nIn order to propagate an error message to the shopper use [CartValidationOutput](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/CartValidationOutput.html).\nThrowing an Exception from any Orchestrator or Calculator would result into CartValidationOutput created on the Cart with generic error message based on Calculator type.\nSpecial case [CartCalculateRuntimeException](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/CartCalculateRuntimeException.html) can be used to rollback all calculation applied to the Cart withing given request processing boundaries.\nAll error cases are propagated to the admin as CommerceDiagnosticEvents (see [CommerceDiagnosticEvent](https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/sforce_api_objects_commercediagnosticevent.htm))\n\nAll reference implementations include examples of how to propagate an error to the user.\n\n## Domain Extensions for Checkout\n\n### CreateOrder Service\n\nThe sample code for the [CreateOrder Service](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/CheckoutCreateOrder.html) extension point includes an Apex class (see [CreateOrderSample.cls](commerce/domain/checkout/order/createOrder/classes/CreateOrderSample.cls)) that provides an example of how to work with the [OrderGraph](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/OrderGraph.html).\n\nA unit test (see [CreateOrderSampleUnitTest.cls](commerce/domain/checkout/order/createOrder/classes/CreateOrderSampleUnitTest.cls)) that follows this approach for [Mocking the Base Apex Class in Tests](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/mock-the-base-apex-class.html).\n\nAlso, there is an \"integration\" test (see [CreateOrderSampleIntegrationTest.cls](commerce/domain/checkout/order/createOrder/classes/CreateOrderSampleIntegrationTest.cls)) that verifies implementation of the CreateOrder extension that calls real default extension point behavior. This testing approach can be used in addition to unit test, it has wider test coverage, but it is less isolated than unit test presented in the example below.\n\n### SplitShipment Service\n\nThe sample code for the [SplitShipment Service](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/SplitShipmentService.html) extension point includes an Apex class (see [SplitShipmentSample.cls](commerce/domain/shipping/splitshipment/SplitShipmentSample.cls)) that creates cart delivery groups by conveyable and non-conveyable products. \n\nAnother example (see [SplitShipmentCallsSuper.cls](commerce/domain/shipping/splitshipment/SplitShipmentCallsSuper.cls)) calls the default implementation.\n\nAlso, there is a unit test (see [SplitShipmentUnitTest.cls](commerce/domain/shipping/splitshipment/SplitShipmentUnitTest.cls)) that follows this approach for [Mocking the Base Apex Class in Tests](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/mock-the-base-apex-class.html).\n\n## Domain Extensions for Buyer Group\n\n### Buyer Group Extensibility Service\n\nThe sample code for Buyer Group Extensibility Service includes the following :\n- An Apex class (in `BuyerGroupEvaluationServiceSample.apxc`) that uses active postal codes to retrieve buyer groups for logged in and guest users.\n- An Org Platform Cache (in `BuyerGroup.cachePartition`) to support low latency in buyer group retrieval.\n- Supported Custom objects for storing and associating buyer groups to users via postal codes.(in `PostalCode__c`, `Active_PostalCode__c` and `Postal_Code_Buyer_Group__c`)\n\n## Deployment\n\nTo deploy this reference implementation, use Workbench:\n\n1. Clone this repository.\n2. From this folder, create a .zip file:\n   ```bash\n   zip -r -X \u003cyour-zip-file\u003e.zip *\n   ```\n3. Open Workbench and go to **Migration** \u003e **Deploy**.\n4. Select the file you created (`\u003cyour-zip-file\u003e.zip`).\n5. Check the **Single Package** checkbox.\n6. Click **Next**.\n7. Click **Deploy**.\n\n## Contributions\n\nWe are not currently accepting external contributions to this repository.\n\n## Issues\n\nWe are not currently tracking issues through GitHub. If you’re experiencing an issue with the sample code, reach out to your Salesforce representative.\n\n## Code of Conduct\n\nWe expect all users of this repository to follow the [Salesforce Open Source Community Code of Conduct](CODE_OF_CONDUCT.md).\n\n## Security\n\nPlease report any security issue to security@salesforce.com as soon as it is discovered.\n\n## License\n\nThe sample code is licensed under a BSD 3-Clause license. See the [license](LICENSE.txt) for details.\n\n## Forward-Looking Statements\n\nThis repository may contain forward-looking statements that involve risks, uncertainties, and assumptions. For more information, see [STATEMENTS](STATEMENTS.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforcedotcom%2Fcommerce-extensibility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforcedotcom%2Fcommerce-extensibility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforcedotcom%2Fcommerce-extensibility/lists"}