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.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #164470

    siteadmin
    Participant

    G-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 не работает? За что он цепляется еще?

    Сэнкью.

    #164592

    Artem Temos
    Keymaster

    Hello,

    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

    #164627

    siteadmin
    Participant

    Apologies 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?

    #164633

    Artem Temos
    Keymaster

    You can review the code and understand how it works in the file js/functions.js. The method name is addToCartAllTypes.

    Regards

    #164675

    siteadmin
    Participant

    Thx. 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.

    #164680

    Artem Temos
    Keymaster

    Sorry, we have removed your screenshot from the forum.

    #164995

    siteadmin
    Participant

    Okay. 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?

    #165038

    Artem Temos
    Keymaster

    The 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

    #165046

    siteadmin
    Participant

    Good. 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

    #165048

    Artem Temos
    Keymaster

    Sorry, but we don’t have an instruction for such customization. It is out of our theme support scope.

Viewing 10 posts - 1 through 10 (of 10 total)