diff --git a/packages/react-components/src/components/line_items/LineItemQuantity.tsx b/packages/react-components/src/components/line_items/LineItemQuantity.tsx index 43811296..84f1c761 100644 --- a/packages/react-components/src/components/line_items/LineItemQuantity.tsx +++ b/packages/react-components/src/components/line_items/LineItemQuantity.tsx @@ -16,16 +16,11 @@ type Props = { max?: number disabled?: boolean readonly?: boolean - /** - * force the update of the line item price using `_external_price: true` attribute - * @link https://docs.commercelayer.io/core/external-resources/external-prices - */ - hasExternalPrice?: boolean } & (Omit & Omit) export function LineItemQuantity(props: Props): JSX.Element { - const { max = 50, readonly = false, hasExternalPrice, ...p } = props + const { max = 50, readonly = false, ...p } = props const { lineItem } = useContext(LineItemChildrenContext) const { updateLineItem } = useContext(LineItemContext) const options: ReactNode[] = [] @@ -39,7 +34,7 @@ export function LineItemQuantity(props: Props): JSX.Element { const handleChange = (e: React.ChangeEvent): void => { const quantity = Number(e.target.value) if (updateLineItem && lineItem) { - void updateLineItem(lineItem.id, quantity, hasExternalPrice) + void updateLineItem(lineItem.id, quantity) } } const quantity = lineItem?.quantity diff --git a/packages/react-components/src/components/line_items/LineItemsContainer.tsx b/packages/react-components/src/components/line_items/LineItemsContainer.tsx index 1f10a906..25d65d80 100644 --- a/packages/react-components/src/components/line_items/LineItemsContainer.tsx +++ b/packages/react-components/src/components/line_items/LineItemsContainer.tsx @@ -65,11 +65,10 @@ export function LineItemsContainer(props: Props): JSX.Element { const lineItemValue: LineItemContextValue = { ...state, loader, - updateLineItem: async (lineItemId, quantity = 1, hasExternalPrice) => { + updateLineItem: async (lineItemId, quantity = 1) => { await updateLineItem({ lineItemId, quantity, - hasExternalPrice, dispatch, config, getOrder, diff --git a/packages/react-components/src/reducers/LineItemReducer.ts b/packages/react-components/src/reducers/LineItemReducer.ts index 7adead07..1df72d89 100644 --- a/packages/react-components/src/reducers/LineItemReducer.ts +++ b/packages/react-components/src/reducers/LineItemReducer.ts @@ -11,7 +11,6 @@ import getErrors from '#utils/getErrors' export interface UpdateLineItemParams { lineItemId: string quantity?: number - hasExternalPrice?: boolean dispatch: Dispatch config: CommerceLayerConfig getOrder: getOrderContext | undefined @@ -42,11 +41,7 @@ export interface LineItemPayload { } export interface LineItemState extends LineItemPayload { - updateLineItem?: ( - lineItemId: string, - quantity?: number, - hasExternalPrice?: boolean - ) => Promise + updateLineItem?: (lineItemId: string, quantity?: number) => Promise deleteLineItem?: (lineItemId: string) => Promise } @@ -100,22 +95,10 @@ export const getLineItems: GetLineItems = (params) => { export async function updateLineItem( params: UpdateLineItemParams ): Promise { - const { - config, - lineItemId, - quantity, - hasExternalPrice, - getOrder, - orderId, - dispatch - } = params + const { config, lineItemId, quantity, getOrder, orderId, dispatch } = params const sdk = getSdk(config) try { - await sdk.line_items.update({ - id: lineItemId, - quantity, - _external_price: hasExternalPrice - }) + await sdk.line_items.update({ id: lineItemId, quantity }) getOrder && (await getOrder(orderId)) dispatch({ type: 'setErrors',