Skip to main content

useTarget
hook

Returns the cart line the extension is attached to. This is only applicable to the Checkout::CartLineDetails::RenderAfter extension point.

PresentmentCartLine

id
string

The ID of the present cart line. This ID isn't stable and might change after any operations on the line items.

quantity
number

The quantity of the merchandise being purchased.

cost

The details about the cost components attributed to the presentment cart line.

title
string

The title of the line item.

lines
[]

The merchandise lines being purchased.

subtitle
string

The subtitle of the line item.

image

The image associated with the line item.

Was this section helpful?

React

import React from 'react';
import {
render,
Text,
useTarget,
} from '@shopify/checkout-ui-extensions-react';

render(
'Checkout::CartLineDetails::RenderAfter',
() => <Extension />,
);

function Extension() {
const {title} = useTarget();
return <Text>Line item title: {title}</Text>;
}