Search by

infrangible / m2-catalog-product-option-wrapper

infrangible

Places every custom option on the product page in its own identifiable container, so themes and other Infrangible option modules can target and style individual options.

Package info

github.com/infrangible-dev/m2-catalog-product-option-wrapper

Homepage

Type:magento2-module

pkg:composer/infrangible/m2-catalog-product-option-wrapper

Statistics

Installs: 283

Dependents: 5

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.2 2026-11-26 17:36 UTC

This package is auto-updated.

Last update: 2026-12-01 15:18:42 UTC


README

Adds an element around every custom option on the product page, so that themes and other modules can find and style single options. The element has the ID product-option-<option ID>, the attribute data-option-id and these CSS classes:

  • field-wrapper
  • field-wrapper-<type>, for example field-wrapper-drop_down
  • field-wrapper-<title>: the title of the option in lower case, with spaces replaced by underscores and an underscore before upper case letters, for example field-wrapper-gift__wrap for "Gift Wrap"
  • field-wrapper-<code>, if the option has a code (for example from Infrangible Catalog Product Option Code)

Requirements

  • Magento Open Source or Adobe Commerce 2.4.6 or newer
  • PHP 8.1 or newer

Installation

composer require infrangible/m2-catalog-product-option-wrapper
bin/magento module:enable Infrangible_CatalogProductOptionWrapper
bin/magento setup:upgrade

In production mode, also run bin/magento setup:di:compile and bin/magento setup:static-content:deploy.

Usage in other modules

Other lists of options can use the same wrapper: add a block of the class Infrangible\CatalogProductOptionWrapper\Block\Product\View\Options\Option with the template Infrangible_CatalogProductOptionWrapper::product/view/options/option.phtml as child product_option_wrapper of the block that renders the options, and wrap the HTML of each option with Infrangible\CatalogProductOptionWrapper\Helper\Data::renderWrapper($block, $option, $optionHtml).

License

Infrangible Catalog Product Option Wrapper is licensed under the MIT License - see the LICENSE file for details.