Home › Forums › WoodMart support forum › Incorrect quantity calculation when adding to cart. Custom short-description.
Incorrect quantity calculation when adding to cart. Custom short-description.
- This topic has 9 replies, 2 voices, and was last updated 4 years, 12 months ago by Artem Temos.
-
AuthorPosts
-
December 22, 2019 at 11:38 am #164470
siteadminParticipantG-translated:
Hello.
I rewrote, for my needs, short-description.php so that all product variations are immediately displayed each with its own price. I left a piece of the code with the inputs and the add button to the cart intact, but when specifying a quantity other than 1, it adds only 1 unit of goods to the cart.
With my JS (now turn off – feel-plodpitomnik.js), it adds as much as it indicated before clicking the add to cart button, but after pressing it the value does not change. For example, if before clicking I indicated the count of 5 units, then after pressing, no matter what count I choose, it will still add 5.
Question: if I left all the classes, tags intact, then why does your script from functions.min.js not work? What is he hooking to yet?
Spasibo.
———-
In my language:
Здравствуйте.
Переписал, под мои нужды short-description.php чтобы все вариации товара сразу выводились каждый со своей ценой. Оставил кусок кода с инпутами и кнопкой добавления в корзину нетронутыми, но при указании количества отличного от 1, добавляет в корзину только одну единицу товара.
С моим JS (сейчас отключен feel-plodpitomnik.js) добавляет столько, сколько указал до нажатия кнопки добавления в корзину, но после ее нажатия значение не меняет. Например, если до нажатия я указал количество 5 единиц, то после нажатия, какое бы число я не выбрал, все равно будет добавлять 5.
Вопрос: если я оставил все классы нетронутыми, то почему ваш скрипт из functions.min.js не работает? За что он цепляется еще?
Сэнкью.
December 23, 2019 at 7:03 am #164592
Artem TemosKeymasterHello,
Sorry, but our support doesn’t include help with theme and plugin’s customizations. Reviewing 3rd party codes is not covered by the support too.
Kind Regards
December 23, 2019 at 9:11 am #164627
siteadminParticipantApologies are accepted.
But you can tell what else, besides the classes and tags indicated by me, your JS script clings. That was the question, not why it didn’t work with my code. What else is your JS hooking to?
December 23, 2019 at 9:58 am #164633
Artem TemosKeymasterYou can review the code and understand how it works in the file
js/functions.js
. The method name isaddToCartAllTypes
.Regards
December 23, 2019 at 1:25 pm #164675
siteadminParticipantThx. I got closer to the solution.
I also asked (2 times) to delete the attached image, because I did not know that it would be displayed in the discussion.
December 23, 2019 at 9:34 pm #164680
Artem TemosKeymasterSorry, we have removed your screenshot from the forum.
December 25, 2019 at 5:25 pm #164995
siteadminParticipantOkay. I got result on single product page, but on quick view my script not working. What different between quick view and single product page inside tag <form class=”variations_form cart”>? Maybe scripts priority, maybe other code use for quick view, maybe something else?
My JS code substitutes on-the-fly the data from my forms into the original ones from Woocommerce.
For example, cut of my code, for your understanding:
max_count = $myForm.find('.qty').attr('max'); $realForm.find('.qty').attr('max',max_count);
So, why in quick view code not work, but work on single product page? And where search solution?
December 26, 2019 at 6:58 am #165038
Artem TemosKeymasterThe quick view has an identical form. The only difference that it is initiated not on page load, but after AJAX request for the quick view information is complete. Check how the quick view works in our functions.js file too.
Regards
December 26, 2019 at 7:32 am #165046
siteadminParticipantGood. Already find it.
But next, related, question: how prevent close pop-up after press button Add-to-cart for continue choose and buying? Without edit your functions.js
December 26, 2019 at 7:34 pm #165048
Artem TemosKeymasterSorry, but we don’t have an instruction for such customization. It is out of our theme support scope.
-
AuthorPosts
Tagged: add to cart, short-description.php, variations
- You must be logged in to create new topics. Login / Register