Both Cart and CartItem have a metadata field that you can use to store custom data about either your cart, or cart items.

Metadata is often used to save user specific state in the cart for UI, checkout options, customer ID, or marketing preferences.

You may want to show more inside your cart for each item, you can use the metadata field to store this.

Metadata can be set when:

  • Updating the cart
  • Adding cart items
  • Updating cart items
  • Setting all cart items