studiomitte/cart-count

Endpoint for EXT:cart cart information which can be retrieved by an AJAX request

Installs: 3 485

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 1

Open Issues: 0

Type:typo3-cms-extension

1.0.0 2023-09-22 08:51 UTC

This package is auto-updated.

Last update: 2024-11-22 11:17:37 UTC


README

This extensions provides a basic endpoint to fetch information from current cart session when using the TYPO3 extension cart. The main benefit is to have pages still cacheable and show e.g. the count of articles in the cart.studiomitte

Example

{
    "net":551,
    "gross":551,
    "count":1,
    "products": [
        {
            "title":"A title",
            "sku":"1234",
            "net":551,
            "gross":551,
            "quantity":1
        }
    ]
}

Installation

Install this extension by using composer require studiomitte/cart-count.

Usage

By calling the URL /?cartId=123 you can retrieve the cart information. 123 is the page configured in the cart plugins where the order is saved.

This extension does not any JS to fetch the data but one example can be

$.get("/?cartId=195", function (data) {
    if (data.count > 0) {
        $(".cart__icon__wrapper").append("<span class='cart__count cart__count--big'>" + data.count + "</span>");
    }
});

Credits

This extension was created by Georg Ringer for Studio Mitte, Linz with ♥.

Find more TYPO3 extensions we have developed that provide additional features for TYPO3 sites.