PHPackages                             revinners/shopware6-add-to-basket-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. revinners/shopware6-add-to-basket-plugin

ActiveShopware-platform-plugin[Utility &amp; Helpers](/categories/utility)

revinners/shopware6-add-to-basket-plugin
========================================

Add to basket plugin for Shopware 6

1.0.14(2w ago)0606↓61.4%MITPHPPHP &gt;=8.2

Since Dec 29Pushed 2w ago1 watchersCompare

[ Source](https://github.com/revinners/ShopwareAddToBasketPlugin)[ Packagist](https://packagist.org/packages/revinners/shopware6-add-to-basket-plugin)[ RSS](/packages/revinners-shopware6-add-to-basket-plugin/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (10)Versions (17)Used By (0)

Add to basket plugin for Shopware 6
===================================

[](#add-to-basket-plugin-for-shopware-6)

The plugin provides a simple API endpoint to add products to the shopping cart.

If you'd like to learn more or work with us, visit our website at [revinners.com](https://revinners.com) for more information.

Installation
------------

[](#installation)

```
composer require revinners/shopware6-add-to-basket-plugin # add the plugin to your Shopware project
./bin/console plugin:refresh # refresh the plugin list
./bin/console plugin:install --activate RevinnersAddToBasket # install and activate the plugin
```

Usage
-----

[](#usage)

Call the API endpoint with the SKU and quantity of the product to add. The endpoint will return a JSON response.

**Endpoint**: `/add-to-basket`
**Method**: `GET`
**Parameters**:

- `sku` (string, required): The SKU (product number) of the product to add.
- `qty` (integer, required): The quantity of the product to add.

### Example Request

[](#example-request)

```
https://example.com/add-to-basket?sku=SW10001&qty=2

```

### Example Responses

[](#example-responses)

```
{
  "success": true,
  "message": "Product added to the basket"
}
```

```
{
  "success": false,
  "message": "Product with SKU SW10001 not found"
}
```

```
{
  "success": false,
  "message": "Validation failed",
  "errors": ["SKU is required", "Quantity must be a positive integer"]
}
```

### Cart info

[](#cart-info)

Returns a summary of the current session's cart (item count and totals). Read-only — it does not modify the cart.

**Endpoint**: `/cart-info`
**Method**: `GET`
**Parameters**: none

The cart is resolved from the current storefront **session cookie**, so the request must be sent **same-origin** with credentials (the cookie). This is the same consumption model as `/add-to-basket`.

#### Example Request

[](#example-request-1)

```
const res = await fetch("/cart-info", {
  credentials: "same-origin",
  headers: { "X-Requested-With": "XMLHttpRequest" },
});
const data = await res.json();
```

#### Example Response

[](#example-response)

```
{
  "success": true,
  "count": 5,
  "lineItemCount": 2,
  "totalPrice": "123.45",
  "netPrice": "100.36",
  "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
  "appliedDiscounts": [
    {
      "percentage": 10.0,
      "isPercentage": true,
      "hasCode": false,
      "promotionId": "0192a…"
    }
  ]
}
```

#### Response fields

[](#response-fields)

FieldTypeDescription`success`boolAlways `true` for a successful response.`count`intTotal quantity of the eligible line items (sum of quantities) — the usual basket-badge number.`lineItemCount`intNumber of distinct line items in the cart (all types).`totalPrice`string**Gross** total of the eligible line items, formatted with 2 decimals and a `.` separator (e.g. `"123.45"`).`netPrice`string**Net** total of the eligible line items, same formatting as `totalPrice`.`currencyId`stringID of the sales-channel currency the totals are expressed in.`appliedDiscounts`arrayOne entry per applied promotion (after Shopware's exclusions). Each: `percentage` (declared % for percentage discounts, otherwise effective share of the item value), `isPercentage` (bool), `hasCode` (bool — `true` for redeemed coupon codes, `false` for automatic promotions), `promotionId` (string|null). Lets the storefront tell which discount is actually active.> **Note:** the totals sum **all** line items regardless of type (a cart may hold several product-like types), **except** the battery deposit (`battery_deposit`) and promotions (`promotion`), which are left out of `count`, `totalPrice` and `netPrice`. The thresholds are meant to be compared against the value of the items themselves, so an applied discount must not lower it. Shipping/delivery costs are excluded implicitly because they are not line items. For an empty cart all numeric values are `0` / `"0.00"`.

Testing
-------

[](#testing)

- `./vendor/bin/phpunit --configuration="custom/plugins/RevinnersAddToBasket" --color` - run the tests
- `./vendor/bin/ecs check src` - run the code style check
- `./vendor/bin/phpstan analyse src` - run the static analysis

License
-------

[](#license)

This plugin is licensed under the MIT License. You are free to use, modify, and distribute this software in accordance with the terms of the license.

For more details, see the [LICENSE](LICENSE) file included in this repository.

About us
--------

[](#about-us)

At Revinners, we specialize in building e-commerce shops and developing custom plugins based on the Shopware 6 platform. Our goal is to deliver efficient, scalable, and tailored solutions to meet the unique needs of online businesses.

If you'd like to learn more or work with us, visit our website at [revinners.com](https://revinners.com) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance97

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Total

15

Last Release

15d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c90a7a5d12959f22ae73d4fe81d63d9045c078ee20ccb99bd547a17e86efe21?d=identicon)[revinners](/maintainers/revinners)

---

Top Contributors

[![98Nowakowski](https://avatars.githubusercontent.com/u/46371047?v=4)](https://github.com/98Nowakowski "98Nowakowski (16 commits)")[![234727](https://avatars.githubusercontent.com/u/37062075?v=4)](https://github.com/234727 "234727 (12 commits)")[![flytomek](https://avatars.githubusercontent.com/u/37069663?v=4)](https://github.com/flytomek "flytomek (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/revinners-shopware6-add-to-basket-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/revinners-shopware6-add-to-basket-plugin/health.svg)](https://phpackages.com/packages/revinners-shopware6-add-to-basket-plugin)
```

###  Alternatives

[frosh/tools

Provides some basic things for managing the Shopware Installation

87820.7k3](/packages/frosh-tools)[shopware/storefront

Storefront for Shopware

684.6M236](/packages/shopware-storefront)[shopware/production

177209.0k](/packages/shopware-production)[shopware/conflicts

Shopware 6 conflicting packages

149.5M10](/packages/shopware-conflicts)[shopware/elasticsearch

Elasticsearch for Shopware

153.9M19](/packages/shopware-elasticsearch)[swag/migration-assistant

Migration plugin for shopware/platform

2042.5k](/packages/swag-migration-assistant)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
