Cart (Shopping Cart) Official
v1.0.0
Full-featured shopping cart with AJAX add-to-cart and checkout for your store.
Cart — Shopping Cart
Full-featured shopping cart for apidcms with AJAX add-to-cart and checkout.
Features
- AJAX add-to-cart without page reload
- Cart icon with item counter in the header
- Cart page with quantity editing and item removal
- Checkout form with name, phone, email, address
- Order storage in
plugin_cart_itemstable - Optional user binding (requires
accountplugin)
Dependencies
- account — optional, for user-bound carts
Installation
- Copy the
cart/folder into your project'splugins/ - Admin panel: Plugins → Cart → Activate
- Plugin creates
plugin_cart_itemstable automatically - Use
{{ render_form('cart') }}in your templates
Settings
| Key | Type | Default | Description |
|---|---|---|---|
require_account |
checkbox | false | Require login for checkout |
Twig
{# Add-to-cart button #}
<button class="add-to-cart" data-product-id="{{ product.id }}">Add to Cart</button>
{# Cart icon #}
<a href="/cart">Cart ({{ cart_count() }})</a>
Routes
| URL | Description |
|---|---|
/cart |
Cart page |
/cart/add |
AJAX add endpoint |
/cart/remove |
AJAX remove endpoint |
/cart/checkout |
Checkout page |
License
MIT