---
schema_version: "1"
id: 23b062aef1ee7d73bf4ec064abf71ba328c52cd4fcd4c2351f261128375abc5f
title: Extension Provider Examples
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/salesforce-commerce/guides/extension-provider-examples.md
canonical_url: https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/extension-provider-examples.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7d3cf77150ad141c72876880c47d200edd92ee0084f3159407a0f7e3445f680d
products:
  - B2B Commerce Developer Guide
  - Salesforce APIs
---
# Extension Provider Examples

Extension provider examples are stored in the [commerce-extensiblity](https://github.com/forcedotcom/commerce-extensibility) repo.

## Buyer Groups Extension Example

This [example](https://github.com/forcedotcom/commerce-extensibility/blob/main/commerce/domain/buyergroup/service/classes/BuyerGroupEvaluationServiceSample.cls) shows an extension provider for a buyer groups service. This example extends the [`CommerceBuyGrp.BuyerGroupEvaluationService`](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_CommerceBuyGrp_BuyerGroupEvaluationService.htm) base class.

## Cart Calculation Orchestrator Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/orchestrators/classes/CartCalculateSample.cls) shows an extension provider for a cart calculation orchestrator. This example extends the [`CartExtension.CartCalculate`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/CartCalculate.html) base class. This example also demonstrates default orchestration behavior for B2B and B2C stores.

**note:** This example demonstrates cart calculation behavior before checkout and during checkout.

## Cart Item Extension Example

This [example](https://github.com/forcedotcom/commerce-extensibility/blob/main/commerce/endpoint/cart/CartItemExtensionSample.cls) shows an extension provider for a cart item. This example extends the [`ConnectApi.BaseEndpointExtension`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/BaseEndpointExtension.html) base class.

## Cart Item Collection Extension Example

This [example](https://github.com/forcedotcom/commerce-extensibility/blob/main/commerce/endpoint/cart/CartItemCollectionExtensionSample.cls) shows an extension provider for a cart item collection. This example extends the [`ConnectApi.BaseEndpointExtension`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/BaseEndpointExtension.html) base class.

## Create Order Service Extension Example

This [example](https://github.com/forcedotcom/commerce-extensibility/blob/main/commerce/domain/checkout/order/createOrder/classes/CreateOrderSample.cls) shows an extension provider for the create order service. This example extends the [`CartExtension.CheckoutCreateOrder`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/CheckoutCreateOrder.html) base class.

## Place Order Service Extension Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/checkout/order/placeOrder/classes) shows an extension provider for the place order service. This example extends the [`CartExtension.CheckoutPlaceOrder`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/CheckoutPlaceOrder.html) base class.

## Inventory Cart Calculator Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/inventory/cart/calculator/classes) shows an extension provider for the inventory cart calculator. This example extends the [`CartExtension.InventoryCartCalculator`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/InventoryCartCalculator.html) base class.

## Pricing Service Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/pricing/service/classes/PricingServiceSample.cls) shows an extension provider for the pricing service. This example extends the [`commercestorepricing.PricingService`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/PricingService.html) base class.

## Promotion Calculator Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/promotion/cart/calculator/classes/PromotionCalculatorSample.cls) shows an extension provider for a promotion calculator. This example extends the [`CartExtension.PromotionsCartCalculator`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/PromotionsCartCalculator.html) base class.

## Shipping Calculator Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/shipping/cart/calculator/classes/ShippingCartCalculatorSample.cls) shows an extension provider for a shipping calculator. This example extends the [`CartExtension.ShippingCartCalculator`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/ShippingCartCalculator.html) base class.

## Split Shipment Service Extension Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/shipping/splitshipment/SplitShipmentSample.cls) shows an extension provider for the split shipment service. This example extends the [`CartExtension.SplitShipmentService`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/SplitShipmentService.html) base class.

## Tax Calculator Example

This [example](https://github.com/forcedotcom/commerce-extensibility/tree/main/commerce/domain/tax/cart/calculator/classes/TaxCartCalculatorSample.cls) shows an extension provider for a tax calculator. This example extends the [`CartExtension.TaxCartCalculator`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/TaxCartCalculator.html) base class.

## Search Products Example

This [example](https://github.com/forcedotcom/commerce-extensibility/blob/main/commerce/endpoint/search/SearchProductsSample.cls) shows an extension provider for the GET-based [product search](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_webstore_search_products.htm) endpoint. This example extends the [`ConnectApi.BaseEndpointExtension`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/BaseEndpointExtension.html) base class.

## Search ProductSearch Example

This [example](https://github.com/forcedotcom/commerce-extensibility/blob/main/commerce/endpoint/search/SearchProductSearchSample.cls) shows an extension provider for the POST-based [product search](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_webstore_product_search.htm) endpoint. This example extends the [`ConnectApi.BaseEndpointExtension`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/BaseEndpointExtension.html) base class.

## Search Suggestions Example

This [example](https://github.com/forcedotcom/commerce-extensibility/blob/main/commerce/endpoint/search/SearchSuggestionsSample.cls) shows an extension provider for [product search suggestions](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_webstore_search_suggestions.htm). This example extends the [`ConnectApi.BaseEndpointExtension`](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/BaseEndpointExtension.html) base class.

## Things to Consider While Working with Endpoint Extensions

Here are some key considerations when extending the Commerce APIs using before and after hooks:

- The Endpoint extensions request parameter doesn’t support values of the `StringList` data type.
- During an asynchronous flow, the post hook for `Commerce_Endpoint_Cart_ItemCollection` can execute either before or after the asynchronous cart processing completes. However, if a before hook is present, it always executes before the cart is processed.
- The before and after hooks for `Commerce_Endpoint_Cart_Item` and `Commerce_Endpoint_Cart_ItemCollection` extension providers are triggered regardless of whether the Cart Checkout API (CCA) is enabled or disabled.
- Data Manipulation Language (DML) operations are not supported in before and after hook. For example, if you attempt to perform a DML operation such as an `insert` or `update` within a before or after hook, it triggers an exception and cause the operation to fail.
- Salesforce callouts are supported in before hooks but not in after hooks for endpoints, except for GET requests. For example, you can use a callout in a before PUT hook to validate data before it's saved. However, making a callout in an after PUT hook results in an operation failure.

**See Also**

- [_B2B Commerce Developer Guide_: Available Extensions](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/available-extensions.html)
- [_B2B Commerce Developer Guide_: Register and Map Extension Class](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/extensions.html)

<!--

## Cart Calculate API Extension Provider Examples

The examples in this section are part of the [Cart Calculate API](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/cart-calculate-api.md) and affect various aspects of cart calculation.

### Cart Calcutation Orchestrator Example

### Inventory Cart Calculator Example

### Inventory Service Example

### Pricing Cart Calculator Example

### Pricing Service Example

### Shipping Cart Calculator Example

### Tax Cart Calculator Example

### Tax Service Example

## Connect API Endpoint Extension Provider Examples

### Commerce_Endpoint_Account_Addresses Example

### Commerce_Endpoint_Account_Address Example

### Commerce_Endpoint_Catalog_Products Example

### Commerce_Endpoint_Catalog_Product Example



### Commerce_Endpoint_Search_ProductsByCategory Example

## Checkout Example

## Order Management Example

-->
