Hi All,
I have a requirement to apply a gender based discount like line discount. I have created a button in the POS. On the select of this i am able to get the whole cart details instead of the selected cart line.
By using this below code I am able to get the whole cart details
let cartRequest: CartOperations.GetCurrentCartClientRequest<CartOperations.GetCurrentCartClientResponse> =
new CartOperations.GetCurrentCartClientRequest();
// Get cart first and then find the first available cartline which does not have any discounts applied.
return context.runtime.executeAsync(cartRequest)
.then((result: ClientEntities.ICancelableDataResult<CartOperations.GetCurrentCartClientResponse>): void => {
if (!result.canceled) {
cart = result.data.result;
}
}).then((): CancelableDiscountRequest => {
if (ObjectExtensions.isNullOrUndefined(cart)) {
return <CancelableDiscountRequest>{
canceled: true,
data: null
};
}
Can you please guide me how to get the selected line from the cart?