Download the PHP package revinners/shopware6-add-to-basket-plugin without Composer
On this page you can find all versions of the php package revinners/shopware6-add-to-basket-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download revinners/shopware6-add-to-basket-plugin
More information about revinners/shopware6-add-to-basket-plugin
Files in revinners/shopware6-add-to-basket-plugin
Package shopware6-add-to-basket-plugin
Short Description Add to basket plugin for Shopware 6
License MIT
Informations about the package shopware6-add-to-basket-plugin
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 for more information.
Installation
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 Responses
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 Response
Response fields
| Field | Type | Description |
|---|---|---|
success |
bool | Always true for a successful response. |
count |
int | Total quantity of the eligible line items (sum of quantities) — the usual basket-badge number. |
lineItemCount |
int | Number 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 |
string | ID of the sales-channel currency the totals are expressed in. |
appliedDiscounts |
array | One 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 ofcount,totalPriceandnetPrice. 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 are0/"0.00".
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
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 file included in this repository.
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 for more information.