:- http_handler(root(cart/add/ProductName), cart_add(ProductName), []). % GET /cart/add/ProductName cart_add(ProductName, Request) :- http_session_id(SessionId), assert_cart_entry(SessionId, ProductName), http_redirect(see_other, root(.), Request).