Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

CodeSignal

Carts API: Line Items, Totals, and Inventory Snapshots

via CodeSignal

Overview

Introduce shopping carts and cart items. You’ll create carts, add and update items, and return computed totals. This module establishes the data flow that powers checkout in the final module.

Syllabus

  • Unit 1: Managing Shopping Carts
    • Observe how carts are created and fetched with totals
    • Implement POST /api/carts to create a cart
    • Implement GET /api/carts/:id to return items and totals
    • Validate cart id and map errors correctly in the loader
  • Unit 2: Adding Cart Line Items
    • Observe how POST /api/carts/:id/items adds or increments line items
    • Validate POST /api/carts/:id/items request bodies
    • Implement transactional add-or-increment for cart items
    • Enforce inventory when adding items and map HTTP status codes
  • Unit 3: Managing Cart Line Items
    • Observe how cart item updates and deletions are scoped to a cart
    • Implement update and delete queries scoped to a cart
    • Validate and enforce rules for updating cart item quantity
    • Implement PATCH and DELETE branches with correct status codes

Reviews

Start your review of Carts API: Line Items, Totals, and Inventory Snapshots

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.