Skip to content

[5.x]: Custom radio options in variants behave differently to pre-defined options #3853

@mitrol-design

Description

@mitrol-design

What happened?

Custom radio button values do not appear in the variant list or dynamic variant titles.

Steps to reproduce

  1. Create a field to be added to a product’s variants (call it 'myField'), set the field type to radio.
  2. Add an option with the label 'One' and the value '1'.
  3. Enable 'Allow custom options'
  4. Create a new product type (call it 'myProductType')
  5. Under settings for myProductType set the variant title to be '{product.title} - {myField}'
  6. Add myField to myProductType’s Variant Fields tab
  7. Create a new product using myProductType (call it 'myProduct')
  8. Create a variant of myProduct selecting 'One' as a the value of myField.
  9. Create a second variant of myProduct creating a custom value of 'Two' for myField (Note: there’s no way to set the value, only the label can be set)
  10. Order the variants as a list, use the View dropdown to show myField
  11. The first variant will have a title of "myProduct - 1" and the myField value of "One" (this is as expected)
  12. The second variant will have a title of "myProduct - Two" and the myField value will be blank.

Expected behavior

Custom radio options should behave identically to pre-defined radio options.

Actual behavior

Dynamic variant titles use the label, not the value of a custom radio (unlike pre-defined radios) and neither custom radio labels nor values appear in the variant list.

Craft CMS version

Craft Pro 5.5.10

Craft Commerce version

5.2.11

PHP version

8.2.24

Operating system and version

Linux 6.5.11-linuxkit

Database type and version

MySQL 8.0.36

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

CKEditor 4.4.0
Retcon 3.2.1
Retour 5.0.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions