Checkout Line

The APIs for managing checkout line item data.

lines: CheckoutLine[]

linesCheckoutLine[]

A list of information about line items.

render("Checkout::Dynamic::Render", (props) => {
const { lines } = props;
console.log(lines);
});

applyCheckoutLinesChange: (change: CheckoutLineChange) => Promise<CheckoutLineChangeResult>

CAUTION

This API can only be used on the checkout page.

applyCheckoutLinesChange(change: CheckoutLineChange) => Promise<CheckoutLineChangeResult>

Updates the information about the line items.

render("Checkout::Dynamic::Render", (props) => {
const { applyCheckoutLinesChange } = props;
applyCheckoutLinesChange({
type: "removeCheckoutLine",
lineItemIds: ["test"],
});
});

useCheckoutLineTarget(): CheckoutLine | undefined

CAUTION

Applicable only to the checkout line extension point Checkout::CheckoutLineDetails::RenderAfter.

Returns the current line item information.

render("Checkout::Dynamic::Render", (props) => {
const target = useCheckoutLineTarget()
console.log(target)
});

useApplyCheckoutLinesChange(): ApplyCheckoutLineChange

CAUTION

This API can only be used on the checkout page.

Returns applyCheckoutLinesChange.

render("Checkout::Dynamic::Render", (props) => {
const applyCheckoutLinesChange = useApplyCheckoutLinesChange();
applyCheckoutLinesChange({
type: "removeCheckoutLine",
lineItemIds: ["test"],
});
});
Was this article helpful to you?