This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0 1.0.1
Elm lang shopping Cart
version 1.1.0
license
native-modules False
elm-version 0.17.0 <= v < 0.18.0
Tag 1.1.0
Committed At 2016-06-17 14:52:39 UTC
mgold/elm-date-format 1.1.4 <= v < 2.0.0 1.8.0
elm-lang/html 1.0.0 <= v < 2.0.0 1.1.0
elm-lang/core 4.0.1 <= v < 5.0.0 4.0.5
elm-community/elm-test 1.1.0 <= v < 2.0.0 1.1.0

Modules

README

elm-cart

Elm lang shopping Cart implementation. Provide a way to add/remove product to/from cart, increment and decrement quantity of product in a cart. Also calculate total quantity and cart subtotal. Cart item stores datetime when the product was added to a cart. This date should be passed to add function as present in the example below.

Please look into examples/Cartapp.elm for the reference.

  import Cart exposing (..)

  type alias Product = { id : Int, price : Float, title : String }
  apple = Product 1 10.0 "Apple"

  add apple cart 12345 ==
    [{ product = { id = 1, price = 10.0, title = "Apple" }, qty = 1, date_added = 12345 }]
  inc apple (add apple cart 12345 ) ==
    [{ product = { id = 1, price = 10.0, title = "Apple" }, qty = 2, date_added = 12345 }]


  subtotal .price (add apple cart 12345) == 10.0
  subtotal .price (inc apple (add apple cart 12345)) == 20.0

You can also find Cart examples in tests/CartTests.elm file.