-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Catalog view -> Add configurable to cart does not work #2434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Having the same issue in here. Far I can see there is not detail going on the post to the ajax controller. This affects to the EE edition as well. |
I found the problem in the template. The form tag is misplaced. Pull request in here: #2714 Cheers |
Updated template file to support quick add to cart from the category view without being redirected to the product page. This change also fixes the enterprise version. Bug related: magento#2434
@matiasnombarasco - I'm still having issues with configurable products and the quick add to cart. I've updated the placement of the form tag and it looks like the values are being posted but the script is redirecting. Form data being passed to item with one configurable property: Data gets posted to /{product}?options=cart, and the page returns a 302 Code and redirects to a GET of the same page /{product}?options=cart. Ironically, at times it does seem to work though on a configurable product. But it's been more like 8/10 times that it won't work. Has the issue returned for you? Perhaps having my frontend completely on SSL may be causing the additional issue for me. |
Hi @tigerx7 , that problem didn't happen to me. But for me looks like you are experiencing another issue, not related with this one. However, looks like the problem might be related with SSL and configuration between secure and insecure urls. I will suggest to check that an also be sure the the ajax urls are under ssl as well. If that doesn't work, is hard to tell what can be the problem. I will suggest to open another thread and discuss this issue as a separate one and see if someone in the community has the same problem than you. Good luck! |
@matiasnombarasco I think your update on the template definitely fixed half the problem. I did a clean install without SSL to test and sure enough, POST data was missing. I changed the location of the However, still was being redirected to product page with "You need to choose options for your item." I found the problem and have been able to reproduce. TroubleshootingI happen to come by a configurable product that was actually adding to the cart from the quick add successfully. I compared the items data to one that wasn't working correctly and found a difference in the attributes required_options and has_options. The one that was working, had both required_options and has_options set to 0. The one that was not working had required_options and has_options set to 1. I updated the configurable product attribute required_options to 0. After reindexing, I was able to add the configurable product successfully from the quick add to cart in the clean install. Technically speaking, I'm assuming that indeed configurable products probably should have required_options set to 1? At least I would think so, I'm not sure how the other configurable items had those two attributes set to 0 though. On the production site, items have been added to the catalog via admin and the rest api. Testing with Clean InstallOn the clean install I did to test this, I only added items via admin. I tried both with just clicking "Add Product" which starts it off as a simple product followed by clicking on "Select Configurations" which turns it into a configurable product. I also attempted by clicking "Add Product" -> "Configurable Product" which starts it off as a configurable product directly. I used the already set color attribute, but changed it to a visual swatch prior to creating the products. Both times, the configurable product was created with has_options = 1 and required_options = 1. When testing from the frontend with the correct Shorterm WorkaroundMy short-term solution is going to be to set all the configurable products in the database to required_options = 0; at least until it can be confirmed if this is a bug deeper in the system. Changing this attribute doesn't seem to break "Add to cart" in the product view. Validation still pops up saying fields are required. Only difference I see so far is that add to cart from catalog page now works. I've kept this reply in this thread since it's still related to the main issue and anyone experiencing this will probably need to both implement #2714 and make sure that the configurable products required_options attribute is set to 0. |
I have to confirm that the shorterm workaround of tigerx7 is working. For me, this is a pretty problematic one. Any idea if this will be fixed soon? And is there an easier workaround (maybe skip the required options check somewhere?) instead of going into the database every time? |
Finally "solved" this by setting the value programmatically to 0 in an plugin. In the di.xml of your custom module:
In your own model:
Good for now, but we need a core fix. |
Hi @mc388 you just need to chose all configurable option in configurable product. |
Hi @vzabaznov, I'm not sure this answers all the questions expressed in this thread. Is 2.0.7 now able to add configurable products to the cart directly instead of redirecting to the single page first? Without me having to write a plugin for it? I cannot find the setting you're describing. Maybe this is different for @matiasnombarasco and @tigerx7? |
This issue is still present in Magento 2.1.1 |
Still an issue in 2.1.1 - can I help? |
I've provided a work around, and exact description and then this is just ignored, think that's a shame. So like @rickwhitehead states here... Can we help? |
just dropping another confirmation that this is still an issue on 2.1.1 |
@mc388 can you please reopen this? I think it is not resolved... |
@ps202 I know by now it takes them about three weeks to get to it. So we should wait it out I guess! |
@TommyKolkman Ok. 👍 |
@ps202 I can't reopen this issue, I don't know why |
still an issue on Magento 2.1.3 and 2.1.4 ! |
@TommyKolkman Methods setTypeHasRequiredOptions (false) and setRequiredOptions(false) do not exist !!! Magento Version : Tests in 2.1.1 and 2.1.4 |
It works in 2.1.5! |
Still an issue on Magento 2.1.8 |
MAGETWO-84209: Impossible specify Bundle option title on store view level
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:The selected Item is in stock.
The text was updated successfully, but these errors were encountered: