Omnira Docs v1.0.0

Section reference › Pricing & commerce

Shopping cart "type": "cart"

A cart page with a product table (quantity steppers, remove buttons, coupon field) and an order summary with subtotal, shipping, tax and total. It is a front-end mock-up that recalculates in the browser.

Example of the cart section
The example below, rendered with placeholder images.

Example#

Paste this into the sections list of a page file:

JSON
{
  "type": "cart",
  "shipping": 6,
  "freeOver": 50,
  "shopHref": "shop.html",
  "checkoutHref": "checkout.html",
  "items": [
    {
      "name": "House Espresso Blend",
      "category": "Coffee",
      "price": 16,
      "qty": 2,
      "image": "placeholder",
      "href": "product-house-espresso.html"
    },
    {
      "name": "Ceramic Pour-over Set",
      "category": "Brewing gear",
      "price": 42,
      "qty": 1,
      "image": "placeholder",
      "href": "product-pour-over.html"
    },
    {
      "name": "Almond Croissants (4 pack)",
      "category": "Bakery",
      "price": "$12.50",
      "qty": 1,
      "image": "placeholder",
      "href": "product-croissants.html"
    }
  ]
}

Options#

OptionTypeDefaultDescription
itemsarray—Products in the cart. You can reuse your shop's product records and add "qty".
shippingnumber9Shipping cost added below the free-shipping threshold.
freeOvernumber75Subtotal from which shipping is free (also printed in the note under the button).
shopHrefstringshop.htmlLink of the "Continue shopping" button.
checkoutHrefstringcheckout.htmlLink of the "Proceed to checkout" button.

Also accepts the options every section accepts: id, tone, padding, fluid, class, hidden.

Fields of each entry in items#

OptionTypeDefaultDescription
namestring—Product name.
pricenumber | string—Unit price: 16 or "$16.00" (numbers are read from the text).
qtynumber1Quantity.
imagestring—Thumbnail.
categorystring—Small line under the name.
hrefstring—Link on the product name. Defaults to "#".

Tips#

  • The cart does not remember anything between pages: it shows the items you list here. Connect a real shop system (e.g. Snipcart, Shopify Buy Button) for actual orders.
  • The currency symbol comes from "currency" in the demo's demo.json (default "$").
  • Tax is fixed at 8%. To change it, edit 0.08 in src/js/modules/core-widgets.js and the "Tax (8%)" label in src/sections/cart.js.
  • Default padding is "sm". Put a page-header ("Your cart") above it.

Editing it in the HTML files#

Rows are <tr data-cart-row data-price="16">; the script reads data-price and the quantity input to update the totals. Shipping and threshold are the data-shipping / data-free-over attributes on [data-cart].

Where it's used#

Open these pages in template/ to see it working:

  • Coffee Shop: template/cafe/cart.html (source src/demos/cafe/pages/cart.json)
  • Gym & Fitness: template/gym/cart.html (source src/demos/gym/pages/cart.json)
  • Interior Design: template/interior-design/cart.html (source src/demos/interior-design/pages/cart.json)
  • Fashion Store: template/fashion-store/cart.html (source src/demos/fashion-store/pages/cart.json)