Line Items
Create a Line Item
Storefront API
- Authentication
- Account
- Account / Address
- Account / Credit Cards
- Account / Orders
- Order Status
- Cart
- Cart / Line Items
- Cart / Other
- Cart / Coupons
- Checkout
- Checkout / State
- Checkout / Shipments
- Checkout / Payments
- Checkout / Store Credit
- Products
- Stores
- Taxons
- Countries
- CMS Pages
- Menus
- Wishlists
- Wishlists / Wished Items
- Digital Downloads
Platform API
- Authentication
- Addresses
- Adjustments
- Classifications
- CMS Pages
- CMS Sections
- Countries
- Data Feeds
- Digital Links
- Digital Assets
- Line Items
- Menu Items
- Menus
- Option Types
- Option Values
- Orders
- Payment Methods
- Payments
- Products
- Promotion Actions
- Promotion Categories
- Promotion Rules
- Promotions
- Roles
- Shipments
- Shipping Categories
- Shipping Methods
- States
- Stock Items
- Stock Locations
- Store Credit Categories
- Store Credit Types
- Store Credits
- Tax Categories
- Tax Rates
- Taxonomies
- Taxons
- Users
- Variants
- Webhook Events
- Webhook Subscribers
- Wished Items
- Wishlists
- Zones
Line Items
Create a Line Item
Creates a Line Item
POST
/
api
/
v2
/
platform
/
line_items
curl --request POST \
--url http://{defaultHost}/api/v2/platform/line_items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"line_item": {
"order_id": "1",
"variant_id": "1",
"quantity": 2,
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "27",
"type": "line_item",
"attributes": {
"quantity": 1,
"price": "10.0",
"created_at": "2022-11-08T19:34:20.312Z",
"updated_at": "2022-11-08T19:34:20.352Z",
"currency": "USD",
"cost_price": "17.0",
"adjustment_total": "0.0",
"additional_tax_total": "0.0",
"promo_total": "0.0",
"included_tax_total": "0.0",
"pre_tax_amount": "10.0",
"taxable_adjustment_total": "0.0",
"non_taxable_adjustment_total": "0.0",
"public_metadata": {},
"private_metadata": {},
"display_discounted_amount": "$10.00",
"display_amount": "$10.00",
"display_final_amount": "$10.00",
"display_subtotal": "$10.00",
"display_pre_tax_amount": "$10.00",
"display_price": "$10.00",
"display_adjustment_total": "$0.00",
"display_additional_tax_total": "$0.00",
"display_promo_total": "$0.00",
"display_total": "$10.00",
"display_included_tax_total": "$0.00"
},
"relationships": {
"order": {
"data": {
"id": "31",
"type": "order"
}
},
"tax_category": {
"data": {
"id": "72",
"type": "tax_category"
}
},
"variant": {
"data": {
"id": "187",
"type": "variant"
}
},
"adjustments": {
"data": []
},
"inventory_units": {
"data": []
},
"digital_links": {
"data": []
}
}
}
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Query Parameters
Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
Body
application/json
Was this page helpful?
curl --request POST \
--url http://{defaultHost}/api/v2/platform/line_items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"line_item": {
"order_id": "1",
"variant_id": "1",
"quantity": 2,
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "27",
"type": "line_item",
"attributes": {
"quantity": 1,
"price": "10.0",
"created_at": "2022-11-08T19:34:20.312Z",
"updated_at": "2022-11-08T19:34:20.352Z",
"currency": "USD",
"cost_price": "17.0",
"adjustment_total": "0.0",
"additional_tax_total": "0.0",
"promo_total": "0.0",
"included_tax_total": "0.0",
"pre_tax_amount": "10.0",
"taxable_adjustment_total": "0.0",
"non_taxable_adjustment_total": "0.0",
"public_metadata": {},
"private_metadata": {},
"display_discounted_amount": "$10.00",
"display_amount": "$10.00",
"display_final_amount": "$10.00",
"display_subtotal": "$10.00",
"display_pre_tax_amount": "$10.00",
"display_price": "$10.00",
"display_adjustment_total": "$0.00",
"display_additional_tax_total": "$0.00",
"display_promo_total": "$0.00",
"display_total": "$10.00",
"display_included_tax_total": "$0.00"
},
"relationships": {
"order": {
"data": {
"id": "31",
"type": "order"
}
},
"tax_category": {
"data": {
"id": "72",
"type": "tax_category"
}
},
"variant": {
"data": {
"id": "187",
"type": "variant"
}
},
"adjustments": {
"data": []
},
"inventory_units": {
"data": []
},
"digital_links": {
"data": []
}
}
}
}