"Submitted form is invalid" when adding a product to cart : Sylius Cart Bundle

StackOverflow https://stackoverflow.com/questions/17228029

  •  01-06-2022
  •  | 
  •  

Вопрос

I apologize if this seems to be a very naive question..but i've just learnt Symfony2 and trying to learn the workings of Sylius.

When I add a product to the cart it seems to always return the error :

Submitted form is invalid

I have searched the solution to this but nothing seems to be documented (or have I missed it ??)

I also commented the validation section but still get the same error. Please help and thanks in advance.

Это было полезно?

Решение

It has something to do with having options on products. I had the same error and looking through the profiler at the Doctrine info there was an error for 2 of the objects that were being persisted to the database. Specifically, it couldn't map Sylius\Bundle\AssortmentBundle\Entity\CustomizableProduct or Sylius\Bundle\AssortmentBundle\Entity\Variant\Variant.

To fix it I had to Generate Variants of the product which is on the product details page in the admin area. Without having variants to add to the cart, it couldn't choose a specific type of the product to add to the cart.

I feel like this should produce a better error, especially when running the app in dev mode.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top