magento2: Catalog view -> Add configurable to cart does not work

Hi,

I am on the catalog page and want to quick add a product to the cart. It works fine for single products but not for configurables.

I select a color and a size and click Add to Card. Next I am redirected to the product detail page with the following notification:

You need to choose options for your item.

The selected Item is in stock.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 21 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Finally “solved” this by setting the value programmatically to 0 in an plugin. In the di.xml of your custom module:

<type name="Magento\Catalog\Model\Product">
    <plugin name="beforeSave" type="Elephant\CFParent\Model\Product" sortOrder="10" disabled="false"/>
</type>

In your own model:


namespace Elephant\CFParent\Model;

class Product
{
   public function afterBeforeSave(\Magento\Catalog\Model\Product $subject, $result)
   {
        /**
         * Temp fix for bug: https://github.com/magento/magento2/issues/2434
         **/

        if( 'configurable' == $subject->getTypeId() ){ 
            $subject->setTypeHasRequiredOptions(false);
            $subject->setRequiredOptions(false);
        }
        return $subject;
   }
}

Good for now, but we need a core fix.