A
Alokai•15mo ago
jeanpier92

AddToCart function that determines whether or not to enable the "ADD TO CART" button

Hi guys!. Here again with the aim of learning. I have a question regarding the canAddToCart function. Analyzing the code and displaying the product parameter in the console, I see that it does not have the stock_status or only_x_left_in_stock keys, which is why the function returns false. Then in SimpreProduct.vue, specifically in the button (addTocart), said function is consulted, denying it, resulting in true... I'm slowly understanding all this. I would appreciate it if you could understand what is happening.
No description
No description
5 Replies
jeanpier92
jeanpier92OP•15mo ago
@rohrig
rohrig
rohrig•15mo ago
hi @jeanpier92 👋 , can you elobrate on what you're confused about? 😄 I'm happy to help
jeanpier92
jeanpier92OP•15mo ago
hi @rohrig.I think I solved it. It goes more to the product configuration side.
Ritcha
Ritcha•14mo ago
Hello I found out that the there is a problem in the productDetails Query. The canAddToCart Method is never true because the two attributes in_stock and only_x_left_in_stock are not mentioned in the query. @rohrig @skirianov Could one of you look into this problem and fix the productDetails query.
alice
alice•11mo ago
Hi @jeanpier92 , I'm having the same problem as you, can you tell me how to configure the product properly? Thank you!

Did you find this page helpful?