Add to Cart Description

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.

Who it’s for

  • 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_description by default if no other attribute is selected.

Installation

Type: Composer
* = in production, use the --keep-generated option

  1. Add the repository to Composer configuration:
    composer config repositories.module.addtocart.description vcs https://github.com/kowalco/addtocart-description
  2. Add an access token for private GitHub:
    composer config --global --auth github-oauth.github.com <YOUR_TOKEN>
  3. Install the module via Composer:
    composer require kowal/module-addtocartdescription
  4. Enable the module:
    php bin/magento module:enable Kowal_AddtocartDescription
  5. Apply database updates:
    php bin/magento setup:upgrade
  6. 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)

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_description attribute appears in the product EAV. If the attribute is not visible in the product edit form, check the attribute set and the General group.
  • The attribute is of type select. If you want to store free text, choose another attribute of type text or textarea in 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.phtml and the HTML is escaped.
  • After changing layouts or templates, run bin/magento cache:flush. For static changes in production, also run bin/magento setup:static-content:deploy according 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 ACL Kowal_AddtocartDescription::config_kowal_addtocartdescription.
  • Default configuration values after installation: Enable = 1, attribute_code = addtocart_description (from etc/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 the addtocart_description attribute).
  • 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:upgrade and 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_description attribute (manually or via a patch revert in a controlled process).
  • Flush cache after rollback.

Requirements / notes

  • Required base module: kowal/base.
  • Depends on Magento_Catalog.
  • The default addtocart_description attribute is created by a data patch during setup:upgrade.

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_Catalog and kowal/base modules to be present.

Product page (reference): https://kowal.store/en/modul-magento-2-opis-pod-przyciskiem-dodaj-do-koszyka

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.