PHPackages                             gift-wrapping/gift-wrapping - 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. gift-wrapping/gift-wrapping

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

gift-wrapping/gift-wrapping
===========================

Per-cart gift wrapping via normal products

1.0.0(5mo ago)00MITPHP

Since Dec 19Pushed 1mo agoCompare

[ Source](https://github.com/medinaahmeti/GiftWrapping)[ Packagist](https://packagist.org/packages/gift-wrapping/gift-wrapping)[ RSS](/packages/gift-wrapping-gift-wrapping/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

GiftWrapping (Shopware 6.6)
===========================

[](#giftwrapping-shopware-66)

Per-cart gift wrapping using **normal products**. The plugin seeds three hidden SKUs (WRAP-SIMPLE / WRAP-DELUXE / WRAP-PREMIUM) with **static UUIDs**. Shoppers choose a wrapping and optional note in the cart. The selection is added as a regular line item (no custom price processor), so taxes, discounts, and currencies work out of the box. A subscriber copies the gift note into the **order custom field** on checkout.

---

Features
--------

[](#features)

- ✅ 3 wrapping SKUs auto-created on install (static IDs; prices editable)
- ✅ Hidden from search/listing, purchasable via direct add-to-cart (Link visibility)
- ✅ Cart widget to pick wrapping + optional recipient note
- ✅ Note saved in cart payload as `giftWrappingNote`
- ✅ **Order** custom field `giftWrappingNote` filled on `CartConvertedEvent`
- ✅ Uses native pricing/tax/discount flows; default cart **remove** works
- ✅ Uninstall deletes SKUs and the custom field set by static IDs

---

Compatibility
-------------

[](#compatibility)

- **Shopware:** 6.6.x
- **PHP:** As required by your Shopware 6.6 installation
- **License:** MIT

---

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

[](#installation)

> Ensure you have at least one **Tax** rate configured in Admin before installing.

```
# from project root
bin/console plugin:refresh
bin/console plugin:install --activate GiftWrapping

# clear cache & compile
bin/console cache:clear
bin/console theme:compile
```

### Update

[](#update)

```
bin/console plugin:update GiftWrapping
bin/console cache:clear
bin/console theme:compile
```

### Uninstall / Remove

[](#uninstall--remove)

```
bin/console plugin:deactivate GiftWrapping
bin/console plugin:uninstall GiftWrapping
# This plugin hard-deletes the 3 wrapping products and the custom field set by static IDs.
```

---

What the plugin creates
-----------------------

[](#what-the-plugin-creates)

On install/update, it **upserts** (no lookups) the following **products** with static IDs:

- `WRAP-SIMPLE` – “Gift Wrap – Simple” – **NET** price: 2.50 — ID: `885374c5cc6245cdb021091314e92b97`
- `WRAP-DELUXE` – “Gift Wrap – Deluxe” – **NET** price: 4.00 — ID: `7a2ef9ae14d347c9b8091f10db6009be`
- `WRAP-PREMIUM` – “Gift Wrap – Premium” – **NET** price: 6.50 — ID: `708e9f072b7a4ec5a70ce5aad74662a0`

Other product flags:

- `shippingFree = true`, `isCloseout = false`, large `stock`
- **Visibility:** `LINK` in all existing sales channels (hidden from search/listing)
- Prices stored as **NET input**, **GROSS** computed with your shop tax (rounded to 2 decimals)

It also creates a **Custom Field Set** (static IDs):

- Set ID: `782b3de31c834f25889adb7e75761a36` (name: `gift_wrapping`, attached to **order**)
- Field ID: `54abbdbbdab943178de2ba7eac8aad9b` (text field `giftWrappingNote`)

On **uninstall**, both the products and the custom field set are deleted by these IDs.

---

How it works (flow &amp; data)
------------------------------

[](#how-it-works-flow--data)

1. Shopper opens the **cart** page.
2. A widget offers the 3 wrapping options and an optional note.
3. Submitting the form calls `POST /wrapping/add` (`frontend.giftwrapping.add`).
4. Controller resolves product by **productNumber**, creates a product **LineItem** with:

    - random lineItemId, `referencedId = productId`, `quantity = 1`
    - `removable = true`, `stackable = true`, `good = false`
    - payload:

        ```
        {
          "isGiftWrapping": true,
          "giftWrappingNote": "Happy Birthday!"
        }
        ```
5. **CartConvertedEvent** subscriber aggregates `payload.giftWrappingNote` from wrapping items and writes to `order.customFields.giftWrappingNote` before the order is persisted.

> This avoids custom price logic and keeps full parity with core cart/order behavior.

---

Storefront widget &amp; route
-----------------------------

[](#storefront-widget--route)

- **Route:** `frontend.giftwrapping.add` (POST) → `/wrapping/add`
- **Twig override path:**`src/Resources/views/storefront/page/checkout/cart/index.html.twig`
- **Recommended block to append:** `page_checkout_cart_main_content`
- **CSRF:** Use `{{ sw_csrf('frontend.giftwrapping.add') }}` in the form
- **Default remove behavior:** works automatically because the line item is marked `removable`and has a proper random `lineItemId`

Example (excerpt):

```
{% sw_extends '@Storefront/storefront/page/checkout/cart/index.html.twig' %}

{% block page_checkout_cart_main_content %}
  {{ parent() }}

    {{ sw_csrf('frontend.giftwrapping.add') }}

{% endblock %}
```

---

Translations (snippets)
-----------------------

[](#translations-snippets)

- **EN:** `src/Resources/translations/en-GB/storefront.en-GB.json`
- **DE:** `src/Resources/snippet/de-DE/storefront.de-DE.json`

Both contain keys under `giftwrapping.*` (title, placeholders, errors, options).

---

Pricing rules (installer)
-------------------------

[](#pricing-rules-installer)

- Input prices in code are **NET**.
- On install, **GROSS = round(NET × (1 + tax/100), 2)** based on the **default tax resolved via DAL**: order by `position ASC, taxRate DESC`, pick first.
- Prices are saved with `linked = true`.

---

Developer reference
-------------------

[](#developer-reference)

- **Plugin:** `GiftWrapping\GiftWrapping`

    - Instantiates the installer directly (no service fetch), calls:

        - `ensureCoreData()`
        - `ensureCustomFields()`
        - uninstall: `removeWrappingProductsStatic()` + `removeCustomFieldsStatic()`
- **Installer:** `GiftWrapping\Service\WrappingInstaller`

    - Static product IDs, NET→GROSS with rounding, link visibility, delete by IDs
    - Custom Field Set: order-level text `giftWrappingNote` (static IDs)
- **Controller:** `GiftWrapping\Storefront\Controller\WrappingController`

    - Adds wrapping as product line item; saves `giftWrappingNote` in **payload**
- **Subscriber:** `GiftWrapping\Subscribers\OrderGiftNoteOnConvertSubscriber`

    - Listens to **`CartConvertedEvent`**
    - Aggregates wrapping notes → writes to `order.customFields.giftWrappingNote`

---

Security, validation, GDPR
--------------------------

[](#security-validation-gdpr)

- Notes are sanitized server-side (HTML stripped, whitespace normalized) and truncated to **280** chars.
- CSRF enforced on the POST route.
- Avoid entering sensitive personal data in gift notes.

---

Troubleshooting
---------------

[](#troubleshooting)

- **Template override not applied:** verify path `.../views/storefront/page/checkout/cart/index.html.twig`, then `bin/console cache:clear && bin/console theme:compile`.
- **Route not found:** ensure controller service is **public** with `controller.service_arguments` tag.
- **Remove button missing:** ensure line item uses **random id**, `referencedId = productId`, and `removable = true`.
- **Tax mismatch:** plugin determines a default tax by DAL query; adjust after install in Admin if needed.

---

Roadmap (optional)
------------------

[](#roadmap-optional)

- PDP widget (pre-cart selection)
- Admin config to override SKUs/labels and character limits
- Optional per-line-item custom field copy (in addition to order header)
- Media assignment &amp; cleanup for wrapping SKUs

---

License
-------

[](#license)

MIT © 2025

###  Health Score

32

—

LowBetter than 70% of packages

Maintenance81

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c90047214ed61da56718d9f92a5d84aadfd9fce62b24780dcabb01f444571562?d=identicon)[medina](/maintainers/medina)

---

Top Contributors

[![medinaahmeti](https://avatars.githubusercontent.com/u/25962930?v=4)](https://github.com/medinaahmeti "medinaahmeti (4 commits)")

### Embed Badge

![Health badge](/badges/gift-wrapping-gift-wrapping/health.svg)

```
[![Health](https://phpackages.com/badges/gift-wrapping-gift-wrapping/health.svg)](https://phpackages.com/packages/gift-wrapping-gift-wrapping)
```

###  Alternatives

[frosh/tools

Provides some basic things for managing the Shopware Installation

83783.3k2](/packages/frosh-tools)[shopware/conflicts

Shopware 6 conflicting packages

149.1M8](/packages/shopware-conflicts)[swag/migration-assistant

Migration plugin for shopware/platform

2040.2k](/packages/swag-migration-assistant)[werkstattl/openblogware

OpenBlogware: A Blog Module for Shopware 6.

437.4k](/packages/werkstattl-openblogware)[heptacom/heptaconnect-bridge-shopware-platform

HEPTAconnect package to support a runtime in a shopware platform project

1025.0k3](/packages/heptacom-heptaconnect-bridge-shopware-platform)[tinect/matomo

Matomo plugin for shopware 6

1411.5k](/packages/tinect-matomo)

PHPackages © 2026

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