Custom Product Options for Magento 2 (Hyva + Luma)
Restyles Magento 2 product custom options on Hyvä and Luma: a price badge on each option, card-style radio and checkbox rows, a drag-and-drop file upload area and, on Hyvä, native HTML5 date and time inputs. Hyvä colors, corner radius and font are CSS variables.
- Free
- Themes listed: Hyvä + Luma
composer require mage2kishan/module-custom-options
- Package requirementsRead the source documentation
- Developer profileView Upwork profile
- Themes listedHyvä + Luma
- PHP versions listed8.1, 8.2, 8.3, 8.4
- Installation questionsDiscuss your store setup
What it does for your store
The main features, as listed in the module documentation.
-
Styled Option Rows
Each custom option renders in a bordered row with its price shown as a badge next to the option title
-
Card-Style Choices
Radio and checkbox values render as card rows; on Luma, card-options.js rewraps Magento's own markup
-
File Upload Drop Zone
Drag and drop or browse, with allowed extensions and max image size shown; Hyvä adds a preview and Remove button
-
Native Date and Time Inputs
On Hyvä, date, time and datetime-local inputs fill Magento's hidden fields; Luma keeps Magento's selects with labels
-
One Admin Switch
Enable Custom Options Styling per default, website or store view; when off, the theme's own option templates render
-
No Database Changes
No tables, cron jobs, plugins, observers or controllers; option prices, cart and checkout stay Magento's own
Installation
Example commands from the Magento root. Follow the package instructions and your staging and deployment process.
- 1Check the releaseMatch Magento, PHP, theme and dependency requirements.
- 2Install on stagingReview Composer changes and follow the package instructions.
- 3Configure and verifyUse the documented settings and test the affected features.
$ composer require mage2kishan/module-custom-options $ bin/magento setup:upgrade $ bin/magento setup:di:compile $ bin/magento setup:static-content:deploy -f $ bin/magento cache:clean
Listed requirements
These are the details supplied in this listing. Confirm the selected release supports your Magento edition, PHP and storefront.
| Magento versions listed | 2.4.6, 2.4.7, 2.4.8 |
|---|---|
| PHP versions listed | 8.1, 8.2, 8.3, 8.4 |
| Themes listed | Hyvä, Luma |
| Composer package | mage2kishan/module-custom-options |
Documentation
Product details and setup guidance. Check the package repository for release-specific instructions.
Overview
Panth Custom Options is a free, MIT-licensed Magento 2 module that replaces the product page templates for customizable options, so text, file, select and date options match the rest of a Hyvä or Luma theme.
You still create options per product under Catalog > Products > Customizable Options. The module only swaps the front-end markup and styling: one bordered row per option, the option price as a badge next to the title, styled text inputs and textareas, card-style radio and checkbox rows, and a drop-zone file upload area. Option values are posted with the field names Magento expects, so prices, cart, checkout and order display stay Magento's own.
It ships two template sets. On Hyvä, the module's hyva_catalog_product_view layout assigns Alpine.js templates that keep each price badge in sync with the final price, show a file preview with name, size and a Remove button, and use native date, time and datetime-local inputs. On Luma, the templates start Magento's priceOptions widget and two small RequireJS scripts: one turns radio and checkbox values into cards, the other gives each date and time select an accessible name. One setting, Enable Custom Options Styling, switches both sets on or off at default, website or store view scope.
Requires Panth Core (mage2kishan/module-core ^1.0) and PHP 8.1 to 8.4. The Hyvä set needs a Hyvä theme.
Best for:
- Stores that sell engraving text, gift messages, uploaded artwork or delivery dates as custom options.
- Hyvä stores whose default option fields look out of place next to the theme.
- Luma stores that want card-style choices without rewriting Magento's option templates.
What you get
What the module changes on the product page:
- Price badge on every option, kept in sync with the final price on Hyvä, including tax display modes.
- Card-style radio and checkbox rows, at least 44px high on Hyvä, exposed as a labelled radiogroup or group.
- File drop zone listing allowed extensions and max image width and height, with a preview row on Hyvä.
- Native HTML5 date, time and datetime-local inputs on Hyvä; labelled Magento selects on Luma.
- Hyvä colors, radius and font set as --custom-options-* CSS variables from etc/theme-config.json.
- No tables, cron, plugins, observers, controllers or API endpoints.
Magento 2 Custom Options
"Panth Custom Options" (module Panth_CustomOptions) replaces the templates that Magento uses to render product customizable options on the product page. The options themselves are still defined per product in the admin under Catalog > Products > Customizable Options; the module only changes the front-end markup and styling: one bordered row per option, the option price shown as a badge next to the title, styled text inputs, textareas and selects, card-style radio and checkbox rows, a drop-zone style file upload area, and native HTML5 date, time and datetime-local inputs in the Hyvä template set.
The module ships two template sets, one written for Hyvä (Alpine.js and Hyvä view models) and one for Luma (Magento's priceOptions widget and RequireJS). It is meant for stores whose products carry customizable options (engraving text, gift messages, uploaded artwork, delivery dates) and that want those fields to match the rest of the theme without rewriting the option templates.
Product page: Custom Product Options for Magento 2 (Hyvä + Luma)
Features
- Replaces the
product.info.optionscontainer template and the text, select, file and date option-type templates ofMagento_Catalogon the product page. - Hyvä template set: styled option rows, a price badge on each option that Alpine.js keeps in sync with the product final price (including the incl./excl. tax display modes handled by
Hyva\Theme\ViewModel\ProductPrice),data-price-amountanddata-price-typeattributes on every input, nativedate,timeanddatetime-localinputs that fill Magento's hidden day, month, year, hour, minute and day-part fields, and a mobile breakpoint at 640px. - Luma template set: a styled container that initialises Magento's standard
priceOptionswidget, the standardremaining-characterscounter for options with a maximum length, radio and checkbox values wrapped into card rows by the module'scard-options.js, and file, date and time controls rendered by Magento's own option blocks inside the styled wrapper. - Required options are marked with an asterisk; text inputs get a placeholder built from the option title.
- File options display the allowed extensions and the maximum image width and height configured on the option, and show the already uploaded file with a "Change" link (Hyvä) or "Change" and "Delete" controls (Luma) when a cart item is edited.
- Colors, border radius and font of the Hyvä template set are CSS custom properties (
--custom-options-*). Their defaults ship inetc/theme-config.jsonand are printed into:rooton every frontend page byPanth_Core; a theme can override them in its ownweb/tailwind/theme-config.jsonor in CSS. - One admin setting that switches both template sets on or off; when it is off the active theme's own option templates render.
- No database tables, cron jobs, plugins, observers, controllers, routes or web API endpoints.
Usage
Which templates render
Two layout files assign the module templates to the existing Magento_Catalog option blocks, each through an ifconfig action on panth_customoptions/general/enabled. catalog_product_view.xml assigns the Luma set:
| Block | Template |
|---|---|
| product.info.options | Panth_CustomOptions::product/view/options/luma/options.phtml |
| product.info.options.text | Panth_CustomOptions::product/view/options/luma/type/text.phtml |
| product.info.options.select | Panth_CustomOptions::product/view/options/luma/type/select.phtml |
| product.info.options.file | Panth_CustomOptions::product/view/options/luma/type/file.phtml |
| product.info.options.date | Panth_CustomOptions::product/view/options/luma/type/date.phtml |
hyva_catalog_product_view.xml is only loaded on Hyvä themes and runs after every catalog_product_view file, including the theme's, so on Hyvä it replaces those assignments with the Hyvä set (and loads css/hyva-options.css):
| Block | Template |
|---|---|
| product.info.options | Panth_CustomOptions::product/view/options/options.phtml |
| product.info.options.text | Panth_CustomOptions::product/view/options/type/text.phtml |
| product.info.options.select | Panth_CustomOptions::product/view/options/type/select.phtml |
| product.info.options.file | Panth_CustomOptions::product/view/options/type/file.phtml |
| product.info.options.date | Panth_CustomOptions::product/view/options/type/date-html5.phtml |
The Hyvä set therefore works on any Hyvä theme, not only on themes that ship their own copies of these templates. The options wrapper block keeps the theme's wrapper.phtml.
The templates apply wherever the catalog_product_view layout handle is used, which includes the product page and the page that opens when a cart item is edited. Nothing changes in the cart or checkout; option values are submitted with the same field names Magento expects, so cart and order display are Magento's own.
Option types
| Magento option type | Hyvä template set | Luma template set |
|---|---|---|
| Field | Text input with maxlength and a "Maximum N characters" note |
Text input with Magento's remaining-characters counter |
| Area | Textarea, 4 rows, same length note | Textarea, 4 rows, same counter |
| File | Drop-zone style area with an upload icon and "Drag & drop or browse" text; after a file is chosen, a preview row with an image thumbnail (or file icon), the file name and size, and a 44px "Remove file" button that clears the input and returns focus to it; extension and size hints below | Drop-zone style area showing the chosen file name; "Allowed files", "Max width" and "Max height" notes |
| Drop-down, Multiple Select | Rendered by Hyva\Theme\ViewModel\CustomOption::getOptionHtml() inside the styled row |
Magento's getValuesHtml() output; selects get the panth-input class from card-options.js |
| Radio Buttons, Checkbox | Rendered by Hyva\Theme\ViewModel\CustomOption::getOptionHtml() inside a radiogroup or group labelled by the option title; each choice row is at least 44px high |
Each .field.choice is rewrapped into a .panth-choice-card label by card-options.js |
| Date, Date & Time, Time | Native date, datetime-local or time input that fills Magento's hidden date and time fields on change |
Magento's own getDateHtml() and getTimeHtml() output inside a fieldset labelled by the option title; date-labels.js gives each select an accessible name (Month, Day, Year, Hour, Minute, AM/PM) |
Overriding templates
All templates are ordinary .phtml files and can be overridden in a theme under app/design/frontend/<Vendor>/<theme>/Panth_CustomOptions/templates/product/view/options/.
Documentation
USER_GUIDE.md covers installation, checking that the module is active, the admin setting, the CSS custom properties, the supported option types and a troubleshooting table.
Changelog
See CHANGELOG.md.
Compatibility
| Requirement | Supported |
|---|---|
| Magento Open Source / Adobe Commerce | 2.4.4 to 2.4.8 |
| PHP | 8.1, 8.2, 8.3, 8.4 (~8.1.0||~8.2.0||~8.3.0||~8.4.0 in composer.json) |
| Themes | Hyvä and Luma (separate template sets, see Usage) |
Composer constraints on Magento packages: magento/framework ^103.0, magento/module-catalog ^104.0, magento/module-config ^101.2, magento/module-store ^101.1.
Requirements
- Magento Open Source or Adobe Commerce 2.4.4 to 2.4.8.
- PHP 8.1, 8.2, 8.3 or 8.4.
mage2kishan/module-core^1.0 (Magento modulePanth_Core), required in composer.json and listed in the module sequence. It provides the "Panth Extensions" configuration tab and thePanth\Core\ViewModel\ThemeConfigview model that turnsetc/theme-config.jsoninto CSS variables.- For the Hyvä template set: a Hyvä theme, because those templates use
Hyva\Theme\Model\ViewModelRegistry,Hyva\Theme\ViewModel\ProductPriceandHyva\Theme\ViewModel\CustomOption. Hyvä is not declared as a Composer dependency. - composer.json has no
suggestsection.
Installation
composer require mage2kishan/module-custom-options
bin/magento module:enable Panth_Core Panth_CustomOptions
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:flush
setup:di:compileis only needed in production mode; in developer mode Magento compiles on demand.setup:static-content:deploy -fis needed because the module shipsview/frontend/web/js/card-options.js,view/frontend/web/js/date-labels.jsandview/frontend/requirejs-config.js, which the Luma template set loads through RequireJS.
Check the result:
bin/magento module:status Panth_CustomOptions
Configuration
Admin path: Stores > Configuration > Panth Extensions > Custom Options. The section is available at default, website and store view scope and is protected by the ACL resource Panth_CustomOptions::config.
General Settings
| Setting | Default | What it does |
|---|---|---|
| Enable Custom Options Styling | Yes | Controls whether the module assigns its templates. The layout files set every option template through <action method="setTemplate" ifconfig="panth_customoptions/general/enabled">, so with Yes the Hyvä set renders on Hyvä themes and the Luma set on Luma, and with No the blocks keep the templates of the active theme (for a Hyvä child theme, its Magento_Catalog copies; for Luma, Magento's own). The value is read at store view scope, so website and store view overrides apply. |
Config path: panth_customoptions/general/enabled (default 1 in etc/config.xml).
There is no admin grid, admin form or product-form addition. Visual defaults are not admin settings; they are the keys of etc/theme-config.json:
| Key | Default | CSS variable |
|---|---|---|
| custom-options-primary | #0F766E | --custom-options-primary |
| custom-options-border | #E5E5E5 | --custom-options-border |
| custom-options-border-focus | #0D9488 | --custom-options-border-focus |
| custom-options-bg | #FFFFFF | --custom-options-bg |
| custom-options-input-bg | #F9FAFB | --custom-options-input-bg |
| custom-options-text | #171717 | --custom-options-text |
| custom-options-text-muted | #525252 | --custom-options-text-muted |
| custom-options-label | #171717 | --custom-options-label |
| custom-options-price | #0F766E | --custom-options-price |
| custom-options-required | #DC2626 | --custom-options-required |
| custom-options-radius | 10px | --custom-options-radius |
| custom-options-font | inherit | --custom-options-font |
These variables are consumed by the Hyvä template set. The Luma template set defines its own --pco-* variables inline in luma/options.phtml and does not read theme-config.json.
Uninstallation
bin/magento module:disable Panth_CustomOptions
composer remove mage2kishan/module-custom-options
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
The module creates no tables. A saved value of panth_customoptions/general/enabled remains in core_config_data. Panth_Core (mage2kishan/module-core) is left installed; remove it separately if no other Panth module needs it.
License
MIT License. Free and open source. See LICENSE in this repository.
Developer Notes
- Module name:
Panth_CustomOptions. Composer package:mage2kishan/module-custom-options. PHP namespace:Panth\CustomOptions(the module contains no PHP classes besidesregistration.php). - Module sequence:
Magento_Catalog,Panth_Core. etc/frontend/di.xmladdsPanth_CustomOptionsto theregisteredModulesargument ofPanth\Core\ViewModel\ThemeConfig, which is howetc/theme-config.jsonis picked up.view/frontend/web/js/card-options.js(RequireJS modulePanth_CustomOptions/js/card-options, initialised fromluma/type/select.phtmlfor radio and checkbox options) clones each radio or checkbox input into a.panth-choice-cardlabel, moves the text of Magento's.price-noticeelement (the formatted option price, in any currency) into a.panth-choice-pricespan, and adds thepanth-inputclass toselect.product-custom-optionelements. Titles and prices are inserted as text, not HTML.view/frontend/web/js/date-labels.js(RequireJS modulePanth_CustomOptions/js/date-labels, initialised fromluma/type/date.phtml) sets a translatablearia-labelon each date and time select from the last part of its field name (month,day,year,hour,minute,day_part).- CSS hooks:
.panth-custom-options,.panth-opt-row,.panth-opt-label,.panth-opt-price,.panth-choice-row,.panth-file-zone(Hyvä set);.panth-options-container,.panth-option-group,.panth-option-label,.panth-price-badge,.panth-choice-card,.panth-file-zone,.panth-input(Luma set). - ACL resource:
Panth_CustomOptions::config("Panth Custom Options") underMagento_Config::config. - Database: no
db_schema.xml, no tables.
| Module Category | Catalog & Products |
|---|---|
| Best For | All Sizes |
Changelog
-
1.0.12, 2026-10-30
- Released under the MIT License: this module is free and open-source software.
-
1.0.11, 2026-10-03
- The Hyvä template set is now assigned by the module's hyva_catalog_product_view.xml, so custom options use the module templates on any Hyvä theme instead of depending on copies inside the theme; the unused wrapper.phtml and duplicate type/date.phtml were removed.
- "Enable Custom Options Styling" now switches both template sets through ifconfig; when it is off the active theme's own option templates render, and the Luma container no longer reads configuration through the object manager.
- Hyvä file option: a preview row with thumbnail, file name and size, and a 44px "Remove file" button that clears the file, updates the price and returns focus to the input.
- Hyvä and Luma radio and checkbox options are exposed as a labelled radiogroup or group instead of a label pointing at no control; Hyvä choice rows are at least 44px high.
FAQ
Does this module change how Magento calculates custom option prices?
No. Option prices are still calculated by Magento. On Luma the module starts Magento's standard priceOptions widget; on Hyvä the price badges follow the product final price through Hyvä's price view model. The module only changes how the options look.
Will it work with my existing product custom options?
Yes. All your existing custom options (set up under Admin > Catalog > Products > [Product] > Customizable Options) automatically render in the new styled UI. No migration required.
Does it support file upload validation?
Magento still validates uploaded files on the server as before. The styled field lists the allowed extensions and the maximum image width and height set on the option, and on Hyvä it shows a preview with the file name, size and a Remove file button.
Can I disable styling on specific products?
Not from the module settings. Enable Custom Options Styling can be set per default, website or store view, but not per product. For a single product you can change the option templates with standard Magento layout update XML.
Does it support Hyvä child themes?
Yes. The module's hyva_catalog_product_view layout assigns its Hyvä templates on any Hyvä theme, including child themes, so the theme does not need its own copies of the option templates.
Does it work on configurable products with custom options?
The module styles every product that shows customizable options on the product page, because it replaces Magento's option templates. Variant selection on configurable products is not changed.
Is the source code available?
Yes. Full source on GitHub at github.com/mage2sk/module-custom-options.
Does it support multi-store setups?
Yes. Enable Custom Options Styling can be set at default, website and store view scope. Colors, radius and font come from CSS variables in etc/theme-config.json, which a theme can override; they are not store view settings.
Questions before you install?
Send me your composer.json and I will check for conflicts first. Free. Installation is +$45, custom work is quoted first.