{"id":20603274,"url":"https://github.com/bitbagcommerce/syliusproductbundleplugin","last_synced_at":"2025-05-07T21:40:22.858Z","repository":{"id":35033809,"uuid":"198418781","full_name":"BitBagCommerce/SyliusProductBundlePlugin","owner":"BitBagCommerce","description":"This plugin allows you to create new products by bundling existing products together.","archived":false,"fork":false,"pushed_at":"2025-01-29T12:28:36.000Z","size":1193,"stargazers_count":21,"open_issues_count":6,"forks_count":40,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-02T01:38:24.264Z","etag":null,"topics":["bitbag","sylius-plugin","symfony"],"latest_commit_sha":null,"homepage":"https://bitbag.io/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BitBagCommerce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-23T11:42:15.000Z","updated_at":"2025-04-10T15:06:10.000Z","dependencies_parsed_at":"2024-05-31T11:59:25.191Z","dependency_job_id":"bb28de69-81d0-468c-a927-eaea43c0f5b8","html_url":"https://github.com/BitBagCommerce/SyliusProductBundlePlugin","commit_stats":{"total_commits":71,"total_committers":17,"mean_commits":4.176470588235294,"dds":0.7464788732394366,"last_synced_commit":"37827adf3c15b9986561ff24354a432fab76094b"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitBagCommerce%2FSyliusProductBundlePlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitBagCommerce%2FSyliusProductBundlePlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitBagCommerce%2FSyliusProductBundlePlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitBagCommerce%2FSyliusProductBundlePlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BitBagCommerce","download_url":"https://codeload.github.com/BitBagCommerce/SyliusProductBundlePlugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252961073,"owners_count":21832179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitbag","sylius-plugin","symfony"],"created_at":"2024-11-16T09:16:43.027Z","updated_at":"2025-05-07T21:40:22.847Z","avatar_url":"https://github.com/BitBagCommerce.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [![](https://bitbag.io/wp-content/uploads/2021/04/ProductBundle.png)](https://bitbag.io/contact-us/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=plugins_productbundle)\n\n# BitBag SyliusProductBundlePlugin\n\n----\n\n[ ![](https://img.shields.io/packagist/l/bitbag/product-bundle-plugin.svg) ](https://packagist.org/packages/bitbag/product-bundle-plugin \"License\")\n[ ![](https://img.shields.io/packagist/v/bitbag/product-bundle-plugin.svg) ](https://packagist.org/packages/bitbag/product-bundle-plugin \"Version\")\n[ ![](https://img.shields.io/github/actions/workflow/status/BitBagCommerce/SyliusProductBundlePlugin/build.yml?branch=master) ](https://github.com/BitBagCommerce/SyliusProductBundlePlugin/actions \"Build status\")\n[ ![](https://poser.pugx.org/bitbag/product-bundle-plugin/downloads)](https://packagist.org/packages/bitbag/product-bundle-plugin \"Total Downloads\")\n[ ![Slack](https://img.shields.io/badge/community%20chat-slack-FF1493.svg)](http://sylius.com/slack)\n[ ![Support](https://img.shields.io/badge/support-contact%20author-blue])](https://bitbag.io/contact-us/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=plugins_productbundle)\n\nWe want to impact many unique eCommerce projects and build our brand recognition worldwide, so we are heavily involved in creating open-source solutions, especially for Sylius. We have already created over **35 extensions, which have been downloaded almost 2 million times.**\n\nYou can find more information about our eCommerce services and technologies on our website: https://bitbag.io/. We have also created a unique service dedicated to creating plugins: https://bitbag.io/services/sylius-plugin-development.\n\nDo you like our work? Would you like to join us? Check out the **“Career” tab:** https://bitbag.io/pl/kariera.\n\n# About Us\n---\n\nBitBag is a software house that implements tailor-made eCommerce platforms with the entire infrastructure—from creating eCommerce platforms to implementing PIM and CMS systems to developing custom eCommerce applications, specialist B2B solutions, and migrations from other platforms.\n\nWe actively participate in Sylius's development. We have already completed **over 150 projects**, cooperating with clients worldwide, including smaller enterprises and large international companies. We have completed projects for such important brands as **Mytheresa, Foodspring, Planeta Huerto (Carrefour Group), Albeco, Mollie, and ArtNight.**\n\nWe have a 70-person team of experts: business analysts and consultants, eCommerce developers, project managers, and QA testers.\n\n**Our services:**\n* B2B and B2C eCommerce platform implementations\n* Multi-vendor marketplace platform implementations\n* eCommerce migrations\n* Sylius plugin development\n* Sylius consulting\n* Project maintenance and long-term support\n* PIM and CMS implementations\n\n**Some numbers from BitBag regarding Sylius:**\n* 70 experts on board\n* +150 projects delivered on top of Sylius\n* 30 countries of BitBag’s customers\n* 7 years in the Sylius ecosystem\n* +35 plugins created for Sylius\n\n---\n[![](https://bitbag.io/wp-content/uploads/2024/09/badges-sylius.png)](https://bitbag.io/contact-us/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=plugins_productbandle)\n\n---\n\n\n\n## Table of Content\n\n***\n\n* [Overview](#overview)\n* [Installation](#installation)\n* [Testing](#testing)\n* [Functionalities](#functionalities)\n* [Demo](#demo)\n* [License](#license)\n* [Contact](#contact)\n* [Community](#community)\n\n# Overview\n\n----\nThe **SyliusProductBundle** plugin allows you to create bundles from existing products in your store. Bundles appear and behave like any other product in your store. This will allow the customer to add multiple products to the cart simultaneously. What's more, products that are sold as bundles encourage customers to meet minimum shipping spending limits - increasing the average order value compared to free shipping.\n\n\n# Installation\n----\n1. Require plugin with composer:\n\n    ```bash\n    composer require bitbag/product-bundle-plugin --no-scripts --with-all-dependencies\n    ```\n\n2. Add plugin dependencies to your `config/bundles.php` file after `Sylius\\Bundle\\ApiBundle\\SyliusApiBundle`.\n\n    ```php\n        return [\n         ...\n        \n            BitBag\\SyliusProductBundlePlugin\\BitBagSyliusProductBundlePlugin::class =\u003e ['all' =\u003e true ],\n        ];\n    ```\n\n3. Import required config in your `config/packages/_sylius.yaml` file:\n\n    ```yaml\n    # config/packages/_sylius.yaml\n    \n    imports:\n        ...\n        \n        - { resource: \"@BitBagSyliusProductBundlePlugin/config/config.yml\" }\n    ```    \n\n4. Import routing in your `config/routes.yaml` file:\n\n    ```yaml\n    \n    # config/routes.yaml\n    ...\n    \n    bitbag_sylius_product_bundle_plugin:\n        resource: \"@BitBagSyliusProductBundlePlugin/config/routes.yml\"\n    ```\n\n5. Extend `Product`(including Doctrine mapping):\n\n    ```php\n    \u003c?php \n   \n    declare(strict_types=1);\n    \n    namespace App\\Entity\\Product;\n    \n    use BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundleInterface;\n    use BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundlesAwareTrait;\n    use BitBag\\SyliusProductBundlePlugin\\Entity\\ProductInterface;\n    use Doctrine\\ORM\\Mapping as ORM;\n    use Sylius\\Component\\Core\\Model\\Product as BaseProduct;\n    use Sylius\\Component\\Product\\Model\\ProductTranslationInterface;\n\n    #[ORM\\Entity]\n    #[ORM\\Table(name: 'sylius_product')]\n    class Product extends BaseProduct implements ProductInterface\n    {\n    use ProductBundlesAwareTrait;\n    \n        /**\n         * @var ProductBundleInterface\n         */\n        #[ORM\\OneToOne(\n            targetEntity: \"BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundleInterface\",\n            mappedBy: \"product\",\n            cascade: [\"all\"]\n        )]\n        protected $productBundle;\n    \n        protected function createTranslation(): ProductTranslationInterface\n        {\n            return new ProductTranslation();\n        }\n    }\n    ```\n\n   Mapping (XML):\n\n   ```xml\n   # config/doctrine/Product.Product.orm.xml\n   \n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n   \u003cdoctrine-mapping xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\"\n                     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n                     xsi:schemaLocation=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\n                                         http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd\"\n   \u003e\n       \u003centity name=\"App\\Entity\\Product\\Product\" table=\"sylius_product\"\u003e\n           \u003cone-to-one field=\"productBundle\" target-entity=\"BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundleInterface\" mapped-by=\"product\"\u003e\n               \u003ccascade\u003e\n                   \u003ccascade-all/\u003e\n               \u003c/cascade\u003e\n           \u003c/one-to-one\u003e\n       \u003c/entity\u003e\n   \u003c/doctrine-mapping\u003e\n   ```\n\n7. Extend `OrderItem` (including Doctrine mapping):\n\n    ```php\n    \u003c?php\n   \n    declare(strict_types=1);\n   \n    namespace App\\Entity\\Order;\n   \n    use BitBag\\SyliusProductBundlePlugin\\Entity\\OrderItemInterface;\n    use BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundleOrderItemInterface;\n    use BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundleOrderItemsAwareTrait;\n    use Doctrine\\Common\\Collections\\ArrayCollection;\n    use Doctrine\\ORM\\Mapping as ORM;\n    use Sylius\\Component\\Core\\Model\\OrderItem as BaseOrderItem;\n    \n    #[ORM\\Entity]\n    #[ORM\\Table(name: 'sylius_order_item')]\n    class OrderItem extends BaseOrderItem implements OrderItemInterface\n    {\n    use ProductBundleOrderItemsAwareTrait;\n    \n        public function __construct()\n        {\n            parent::__construct();\n            $this-\u003einit();\n        }\n    \n        /**\n         * @var ArrayCollection|ProductBundleOrderItemInterface[]\n         */\n        #[ORM\\OneToMany(\n            targetEntity: \"BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundleOrderItemInterface\",\n            mappedBy: \"orderItem\",\n            cascade: [\"all\"]\n        )]\n        protected $productBundleOrderItems;\n    }\n    ```\n   \n   Mapping (XML):\n\n   ```xml\n   # config/doctrine/Order.OrderItem.orm.xml\n\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n   \u003cdoctrine-mapping xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\"\n                     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n                     xsi:schemaLocation=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\n                                         http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd\"\n   \u003e\n       \u003centity name=\"App\\Entity\\Order\\OrderItem\" table=\"sylius_order_item\"\u003e\n           \u003cone-to-many field=\"productBundleOrderItems\" target-entity=\"BitBag\\SyliusProductBundlePlugin\\Entity\\ProductBundleOrderItem\" mapped-by=\"orderItem\" \u003e\n               \u003ccascade\u003e\n                   \u003ccascade-all/\u003e\n               \u003c/cascade\u003e\n           \u003c/one-to-many\u003e\n       \u003c/entity\u003e\n   \u003c/doctrine-mapping\u003e\n   ```\n\n9. Add configuration for extended product, order item and product variant repository:\n\n    ```yaml\n    # config/packages/_sylius.yaml\n   \n    sylius_product:\n        resources:\n            product:\n                classes:\n                    model: App\\Entity\\Product\\Product\n            product_variant:\n                classes:\n                    model: App\\Entity\\Product\\ProductVariant\n                    repository: BitBag\\SyliusProductBundlePlugin\\Repository\\ProductVariantRepository\n   sylius_order:\n       resources:\n           order_item:\n               classes:\n                   model: App\\Entity\\Order\\OrderItem\n    \n    ```\n\n10. Add 'Create/Bundle' to product grid configuration:\n\n    ```yaml\n    # config/packages/_sylius.yaml\n    \n    sylius_grid:\n        grids:\n            sylius_admin_product:\n                actions:\n                    main:\n                        create:\n                            type: links\n                            label: sylius.ui.create\n                            options:\n                                class: primary\n                                icon: \"tabler:plus\"\n                                header:\n                                    icon: cube\n                                    label: sylius.ui.type\n                                links:\n                                    simple:\n                                        label: sylius.ui.simple_product\n                                        route: sylius_admin_product_create_simple\n                                    configurable:\n                                        label: sylius.ui.configurable_product\n                                        route: sylius_admin_product_create\n                                    bundle:\n                                        label: bitbag_sylius_product_bundle.ui.bundle\n                                        route: bitbag_product_bundle_admin_product_create_bundle\n       \n    ```\n11. If you have full configuration in xml override doctrine config :\n\n    ```yaml\n    # config/packages/doctrine.yaml   \n    \n    mappings:\n            App:\n                is_bundle: false\n                type: xml\n                dir: '%kernel.project_dir%/config/doctrine'\n                prefix: 'App\\Entity'\n                alias: App\n   \n    \n    ```\n\n12. Copy plugin templates into your project `templates/bundles` directory:\n\n    ```bash\n    mkdir templates/bundles\n    cp -R vendor/bitbag/product-bundle-plugin/tests/Application/templates/bundles/* templates/bundles/\n    ```\n\n13. Please clear application cache by running command below:\n\n    ```bash\n    bin/console cache:clear\n    ```\n\n14. Finish the installation by updating the database schema and installing assets:\n\n    ```bash\n    bin/console doctrine:migrations:diff\n    bin/console doctrine:migrations:migrate\n    ```\n15. Add plugin assets to your project:\n    [Import webpack config](./README_webpack-config.md)*\n\n# Testing\n----\n\n```bash\ncomposer install\ncd tests/Application\nyarn install\nyarn build\nbin/console assets:install public -e test\nbin/console doctrine:schema:create -e test\nbin/console server:run 127.0.0.1:8080 -d public -e test\nopen http://localhost:8080\nvendor/bin/behat\n```\n\n# Functionalities\n\nAll main functionalities of the plugin are described **[here.](https://github.com/BitBagCommerce/SyliusProductBundlePlugin/blob/master/doc/functionalities.md)**\n\n---\n\nIf you need some help with Sylius development, don't be hesitated to contact us directly. You can fill the form on [this site](https://bitbag.io/contact-us/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=plugins_productbundle) or send us an e-mail at hello@bitbag.io!\n\n---\n# Demo\n---\nWe created a demo app with some useful use-cases of plugins! Visit http://demo.sylius.com/ to take a look at it.\n\n**If you need an overview of Sylius' capabilities, schedule a consultation with our expert.**\n\n[![](https://bitbag.io/wp-content/uploads/2020/10/button_free_consulatation-1.png)](https://bitbag.io/contact-us/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=plugins_productbundle)\n\n\n# Additional resources for developers\n---\nTo learn more about our contribution workflow and more, we encourage you to use the following resources:\n* [Sylius Documentation](https://docs.sylius.com/en/latest/)\n* [Sylius Contribution Guide](https://docs.sylius.com/en/latest/contributing/)\n* [Sylius Online Course](https://sylius.com/online-course/)\n* [Sylius Product Bundle Plugin Blog](https://bitbag.io/blog/product-bundling-sylius)\n\n# License\n---\n\nThis plugin's source code is completely free and released under the terms of the MIT license.\n\n[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen.)\n\n# Contact\n---\nThis open-source plugin was developed to help the Sylius community. If you have any additional questions, would like help with installing or configuring the plugin, or need any assistance with your Sylius project - let us know! **Contact us** or send us an **e-mail to hello@bitbag.io** with your question(s).\n\n# Community\n---- \n\nFor online communication, we invite you to chat with us \u0026 other users on **[Sylius Slack](https://sylius-devs.slack.com/).**\n\n[![](https://bitbag.io/wp-content/uploads/2024/09/badges-partners.png)](https://bitbag.io/contact-us/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=plugins_productbundle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitbagcommerce%2Fsyliusproductbundleplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitbagcommerce%2Fsyliusproductbundleplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitbagcommerce%2Fsyliusproductbundleplugin/lists"}