I want to show dropdown attribute on product listing page but Magento is not providing that functionality so I have created attribute as text swatch now I want to show that attribute as a dropdown on the product listing page.

it is possible to create a dropdown of text swatch? in list.phtml attribute as displaying through this line

<?= $block->getProductDetailsHtml($_product) ?>

enter image description here

like this i want to create a dropdown


In order to change the text swatch to Dropdown. You need to do following steps

  1. Login to Admin got to Stores -> Attributes -> Product
  2. Open particular swatch attribute Change Catalog Input Type for Store Owner from Text Swatch to Dropdown. After that add Dropdown options and save attribute.
  3. Clean cache

I hope this will help

|improve this answer|||||
  • but that dropdown is not showing in product listing page I want to show that on product listing page – Ashish Ramchandani Nov 19 '19 at 6:38
  • Look I change the attribute representation from text swatch to dropdown. where ever that attribute show, it will show as the dropdown. – Muhammad Hasham Nov 19 '19 at 6:42
  • but magento2 does not show dropdown attribute on lisitng page we have customize it – Ashish Ramchandani Nov 19 '19 at 7:12
  • @AshishRamchandani you mentioned in your question that you already able to fetch the option in product listing, as you attached the screenshot as well – Muhammad Hasham Nov 19 '19 at 10:10
  • @AshishRamchandani As per your question, I didn't mention the way of fetching product option in product listing page. I just mention the way how you convert the text swatch product option attribute to dropdown product option attribute. – Muhammad Hasham Nov 19 '19 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.