Skip to content

Yes/No attribute value is not shown on a product details page #6634

@alexkuk

Description

@alexkuk

Preconditions

  • Magento CE 2.1.1 with sample data (Luma theme).

Steps to reproduce

  1. Navigate to the backend.
  2. Go to Stores -> Attributes -> Product
  3. Click on the Add New Attribute button
  4. Set "Catalog Input Type for Store Owner" = Yes/No, set "Visible on Catalog Pages on Storefront" = Yes, and fill other required fields.
  5. Click Save Attribute button
  6. Go to Products -> Catalog. Click on some product that is visible on storefront.
  7. Find the newly created attribute field and fill it with Yes or No value. Save product.
  8. Clean cache and reindex:
$ bin/magento cache:clean
$ bin/magento indexer:reindex
  1. Open a storefront product page.

Actual result

The More Information tab doesn't contain our newly created attribute.

Expected result

The More Information tab contains our newly created attribute.

Additional information

If I make some yes/no attribute visible on frontend, it doesn't appear in the More Information tab on a product details page. I debugged it and found that this relates to the fact that translated string are wrapped into the Phrase object: https://community.magento.com/t5/Magento-2-Feature-Requests-and/function-returns-Phrase-object-Could-this-return-string/idi-p/45075

Particularly, it's \Magento\Catalog\Block\Product\View\Attributes::getAdditionalData() - it requires $value to be string to be added to the $data array. In case of Yes/No attributes $value is an object of \Magento\Framework\Phrase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CatalogFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions