Add to Cart Description
Composer package kowal/module-addtocartdescription · repository version 1.0.12
Product page
Add to Cart Description — kowal.co
Description
This Magento 2 module adds the ability to display a short message under the “Add to Cart” button on the product page. The value comes from a selected product attribute (by default addtocart_description).
The module adds the product attribute addtocart_description via a data patch and provides a configuration option where you can select another attribute to display. The attribute list in configuration is limited to the types text, textarea, and select. For select attributes, the option label is displayed; for text-based attributes, the raw field value is shown.
The output works on product pages for: simple, configurable, and bundle products. The block is placed around the Add to Cart section and can be enabled per store view.
For whom
- Magento 2 stores that want to add a short message/promotion next to the purchase button.
- Implementation teams that need a simple field for a sales message on the product page.
Features
- Adds the product attribute
addtocart_description(data patch). - Lets you choose any product attribute to display (
text,textarea,select). - Renders the message under the “Add to Cart” button.
- Supports simple, configurable, and bundle products.
- Ability to enable/disable the module per store view.
- Uses
addtocart_descriptionby default if no other attribute is selected.
Installation
* = in production, use the --keep-generated option
- Add the repository to Composer configuration:
composer config repositories.module.addtocart.description vcs https://github.com/kowalco/addtocart-description - Add an access token for private GitHub:
composer config --global --auth github-oauth.github.com <YOUR_TOKEN> - Install the module via Composer:
composer require kowal/module-addtocartdescription - Enable the module:
php bin/magento module:enable Kowal_AddtocartDescription - Apply database updates:
php bin/magento setup:upgrade - Flush cache:
php bin/magento cache:flush
Configuration
- Path:
Stores -> Configuration -> kowal -> Add to Cart Description -> Settings Enable module(enables/disables the display)Product Attribute to Display(select the attribute to show)
Requirements / notes
- Required base module:
kowal/base. - Depends on
Magento_Catalog. - The default
addtocart_descriptionattribute is created by a data patch duringsetup:upgrade.
Deployment and operations
- Configuration changes are per store view (Store View scope). Make sure values are set at the correct level.
- After installing the module, the
addtocart_descriptionattribute appears in the product EAV. If the attribute is not visible in the product edit form, check the attribute set and theGeneralgroup. - The attribute is of type
select. If you want to store free text, choose another attribute of typetextortextareain configuration. - The module uses layouts for product pages:
catalog_product_view,catalog_product_view_type_configurable,catalog_product_view_type_bundle. - The value is rendered in
Kowal_AddtocartDescription::addtocart-description.phtmland the HTML is escaped. - After changing layouts or templates, run
bin/magento cache:flush. For static changes in production, also runbin/magento setup:static-content:deployaccording to your deployment policy. - No additional indexes or cron jobs are required for the module.
- Admin configuration menu:
Stores -> Configuration -> kowal -> Add to Cart Description. Access is controlled by ACLKowal_AddtocartDescription::config_kowal_addtocartdescription. - Default configuration values after installation:
Enable=1,attribute_code=addtocart_description(frometc/config.xml). - The module does not modify the database beyond adding the product EAV attribute; no new tables and no additional log tables.
Deployment checklist
- Upload the module (Composer or ZIP) and make sure autoloading works.
- Run
bin/magento module:enable Kowal_AddtocartDescription. - Run
bin/magento setup:upgrade(creates theaddtocart_descriptionattribute). - Make sure the attribute is included in the correct attribute set and has values on products.
- Configure the attribute to display per store view.
- Run
bin/magento cache:flush. - If required in production:
bin/magento setup:static-content:deploy.
CI/CD and environments
- In your pipeline, include
setup:upgradeand cache cleaning after deploying the module. - No data migrations are required beyond the EAV attribute; rollback is simply disabling the module and optionally removing the attribute.
- Multistore environments: set configuration in the correct scope (Default/Website/Store View) according to the store policy.
Rollback
- Disable the module:
bin/magento module:disable Kowal_AddtocartDescription. - Optionally remove the
addtocart_descriptionattribute (manually or via a patch revert in a controlled process). - Flush cache after rollback.
Compatibility
- Magento 2.x (module based on standard EAV and catalog layouts).
- PHP versions compatible with the Magento version used in the project.
- Requires the
Magento_Catalogandkowal/basemodules to be present.
FAQ
Q: The description doesn’t show on the product — what should I check?
A: Check that the module is enabled, the attribute has a value on the product, the configuration is set for the correct store view, and the cache has been cleared.
Q: Can I use my own attribute?
A: Yes—select it in configuration. The list shows only attributes of type text, textarea, and select.
Verify the installation
bin/magento module:status Kowal_AddtocartDescription
Set the selected attribute on a test product. Open the product in the same store view and check the text beneath the purchase button.
If the source is a select attribute, compare the displayed text with the option label for that store view.