Constructor
new DCShoppingCart()
Properties:
Name | Type | Description |
---|---|---|
catalogCode |
String | to which child catalog code these offers are belongs to. |
cartContextKey |
String | holds the unique existing cart Id. |
Example
Sample Usage -
Include the component in your template simply by adding <c-dc-shopping-cart> custom tag
<c-dc-shopping-cart catalog-code="CATALOG_CODE" cart-context-key="CARTCONTEXTKEY"></c-dc-shopping-cart>
--------------------------------------------------------------------------------------------------------------------------------------
KEY INFO -
events fired : vlocity-dc-router, vlocity-dc-event-source-basket, vlocity-dc-sign-in
events registered :
| Event Name | Event source component | Callback Function | Description |
|-----------------------------------------|----------------------------------------------------------------------------------------------------|--------------------------|----------------------------------------------------------------|
| vlocity-dc-checkout-cart | c-dc-total-bar | checkoutCart | checkout cart to create order |
| vlocity-dc-delete-cart-offer | c-dc-shopping-offer-details | deleteOfferFromCart | delete offer from cart using basketAction="DeleteFromBasket" |
| vlocity-dc-update-cart-offer | c-dc-shopping-offer-details | updateOfferInCart | update offer to cart using basketAction="updateBasket" |
| vlocity-dc-open-edit-modal | c-dc-shopping-offer-details | configureEditModalData | to open modal where we can edit the offer & child line items |
| vlocity-dc-configure-offer-attributes | c-dc-offer-attribute-config | updateOfferInCart | this function is called on change of selected offer attributes.|
| vlocity-dc-remove-promo | c-dc-applied-promotion-list | removePromoFromCart | this function is called on change of selected offer attributes.|
| vlocity-dc-promo-list-updated | c-dc-promotion-list | addToCart | this function is called on change or update the promotions. |
| vlocity-dc-refresh-edit-modal-content | c-dc-offer-group-sections | refreshEditModalContent | refresh content of edit modal popup |
| | | | |
| | Mutiple Event Sources: | | |
| | | Component Name | Description | | |
| vlocity-dc-checkout-success | |---------------------------------------|-----------------------------------------------------| | |
| | | c-dc-review-order | Event triggered on phase success | | |
| | | c-dc-signin | | createOrder | |
| | | c-dc-update-billing-address | | | |
| | | | | |
Dependency - c-dc-shopping-cart has no dependency on parent component.
| Parent Component | Expected Children Components |
|------------------|------------------------------|
| none | c-dc-shopping-nested-offer |
| | c-dc-shopping-offer-details |
Sample with slots -
<c-dc-shopping-cart>
<span slot="{slot_name}">
Custom HTML elements goes here
</span>
</c-dc-shopping-cart>
List of available slots -
| Slot names | Dynamic | Description | Impact |
|-----------------------------------|-------------|---------------------------------------|------------------------|
| dc-shopping-cart-wrapper | - | Wrapper for component | Replaces template DOM |
| dc-continue-btn | - | Continue Button | Replace Button |
| dc-sub-total-extra-column-title | - | new column in sub total section | Adds new column |
| dc-sub-total-extra-column-value | - | new column value in sub total section | Adds new column |
Extends
Methods
(async, static) addToCart(offer)
This function is used to fetch all the offers
Parameters:
Name | Type | Description |
---|---|---|
offer |
object | An object containing current offer. |
(static) addToCartGetInput(catalogCode)
This function is used to get addToCart input object
Parameters:
Name | Type | Description |
---|---|---|
catalogCode |
object | An object containing current catalog. |
(static) addToCartHandleFailure(error)
This function is used to handle addToCart failure
Parameters:
Name | Type | Description |
---|---|---|
error |
object | Error Object from SDK call. |
(static) addToCartPostHook(response)
A custom function to be used by customers for customisation, any custom action after fetch offers call is successfull can be written here
Parameters:
Name | Type | Description |
---|---|---|
response |
object | SDK Response object. |
(static) addToCartPreHook(input)
A custom function to be used by customers for customisation, any custom action prior to fetch offers call can be written here
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) addToCartPreSDKCalls(input)
This function is used to execute any action before addToCart SDK call is made.
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) addToCartProcessResponse(response)
This function is used to process addToCart response
Parameters:
Name | Type | Description |
---|---|---|
response |
object | Response Object from SDK call. |
(static) addToCartSdkCall(input)
This function is used to make SDK call for addToCart
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) checkoutCart()
callback function for event vlocity-dc-checkout-cart.
Checkout cart to create an order.
Checkout cart to create an order.
(static) closeEditModal()
Method to close edit modal.
(static) configureEditModalData()
Method to configure edit modal data
(static) continueShopping()
Method to route to home screen.
(async, static) createOrder()
Method to create the order.
(static) createOrderGetInput()
Function to fetch the create order sdk call inputs
(static) createOrderPostHook()
A custom function to be used by customer's for customisation, any custom action after fetch offers call can be written here.
(static) createOrderPreHook()
A custom function to be used by customer's for customisation, any custom action prior to fetch offers call can be written here.
(static) createOrderPreSDKCalls()
This function is used to do any changes prior to sdk calls
(static) createOrderProcessResponse(response)
This function is used to process createOrder response
Parameters:
Name | Type | Description |
---|---|---|
response |
object | Response Object from SDK call. |
(static) createOrderSDKCall()
This function is used to do actual sdk calls
(async, static) deleteOfferFromCart(offer)
callback function for event vlocity-dc-delete-cart-offer.
Deleting offer from bundle with basketAction = "DeleteFromBasket" or basketAction = "DeleteChildProduct"
Deleting offer from bundle with basketAction = "DeleteFromBasket" or basketAction = "DeleteChildProduct"
Parameters:
Name | Type | Description |
---|---|---|
offer |
Object | offer that need to be deleted. |
(static) deleteOfferFromCartGetInput(offer)
This function is used to get deleteOfferFromCart input object
Parameters:
Name | Type | Description |
---|---|---|
offer |
object | An object denoting current offer to be deleted. |
(static) deleteOfferFromCartHandleFailure(error)
This function is used to handle deleteOfferFromCart failure
Parameters:
Name | Type | Description |
---|---|---|
error |
object | Error Object from SDK call. |
(static) deleteOfferFromCartPostHook(response)
A custom function to be used by customers for customisation, any custom action after deleteOfferFromCart call is successfull can be written here
Parameters:
Name | Type | Description |
---|---|---|
response |
object | SDK Response object. |
(static) deleteOfferFromCartPreHook(input)
A custom function to be used by customers for customisation, any custom action prior to deleteOfferFromCart call can be written here
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) deleteOfferFromCartPreSDKCalls()
This function is used to execute any action before deleteOfferFromCart SDK call is made.
(static) deleteOfferFromCartProcessResponse(response)
This function is used to process deleteOfferFromCart response
Parameters:
Name | Type | Description |
---|---|---|
response |
object | Response Object from SDK call. |
(static) deleteOfferFromCartSDKCall(input)
This function is used to make SDK call for deleteOfferFromCart
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) disconnectedCallback()
disconnectedCallback () is invoked when c-dc-shopping-cart is removed from the document’s DOM.
(static) editItemsInCart()
Method to open edit modal.
(static) findProductGroup()
Method to find product group to be edited
(async, static) getItemsInCart()
Fetching shopping cart items using getItemsInCart()
(static) getItemsInCartGetInput()
This function is used to get getItemsInCart input object
(static) getItemsInCartPostHook(response)
A custom function to be used by customers for customisation, any custom action after getItemsInCart call is successfull can be written here
Parameters:
Name | Type | Description |
---|---|---|
response |
object | SDK Response object. |
(static) getItemsInCartPreHook(input)
A custom function to be used by customers for customisation, any custom action prior to getItemsInCart call can be written here
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) getItemsInCartPreSDKCalls()
This function is used to execute any action before getItemsInCart SDK call is made.
(static) getItemsInCartSDKCall(input)
This function is used to make SDK call for getItemsInCart
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) getSDKInstance()
This function gets digital commerce sdk instance
(static) getTranslationLabels()
Method to get digital commerce SDK instance.
(static) handleCreateOrderFailure()
A custom function to be used by customers for handling api failures
(static) initLogin()
Method to initiate login/signup SDK call.
(static) removePromoFromCart()
Method to remove promotion from cart
(async, static) updateOfferInCart(offer)
callback function for event vlocity-dc-update-cart-offer.
Updating offer to bundle with basketAction = "updateBasket"
Updating offer to bundle with basketAction = "updateBasket"
Parameters:
Name | Type | Description |
---|---|---|
offer |
Object | offer that need to be updated. |
(static) updateOfferInCartGetInput()
This function is used to get updateOfferInCart input object
(static) updateOfferInCartHandleFailure(error)
This function is used to handle updateOfferInCart failure
Parameters:
Name | Type | Description |
---|---|---|
error |
object | Error Object from SDK call. |
(static) updateOfferInCartPostHook(response)
A custom function to be used by customers for customisation, any custom action after updateOfferInCart call is successfull can be written here
Parameters:
Name | Type | Description |
---|---|---|
response |
object | SDK Response object. |
(static) updateOfferInCartPreHook(input)
A custom function to be used by customers for customisation, any custom action prior to updateOfferInCart call can be written here
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) updateOfferInCartPreSDKCalls()
This function is used to execute any action before updateOfferInCart SDK call is made.
(static) updateOfferInCartProcessResponse(response)
This function is used to process updateOfferInCart response
Parameters:
Name | Type | Description |
---|---|---|
response |
object | Response Object from SDK call. |
(static) updateOfferInCartSDKCall(input)
This function is used to make SDK call for updateOfferInCart
Parameters:
Name | Type | Description |
---|---|---|
input |
object | Current Input Object. |
(static) updateProductType()
Method to update product type to be edited in edit modal.