Shopping cart values are not updating in case more items are in cart than in stock

This topic has 22 replies, 3 voices, and was last updated 1 months, 3 weeks ago ago by Rose Tyler

  • Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 24, 2024 at 12:49

    For example:
    Customer 1 adds a product (8 items) in shopping cart and 8 are left.
    Customer 2 buys one item of the same product, now only 7 are left, but Customer 1 has still 8 in shopping cart.
    Customer 1 gets notification that only 7 are left and he/she has to update the cart values.
    Customer 1 can change the numbers, but cart gets not updated. Only way to continue is to remove the item from shopping cart.

    Always load “wc-cart-fragments” is turned on.
    Ajax is also turned on from Woocommerce -> Products -> General Settings
    Cached is cleared.
    No additional customization is added.
    Only Plugins activated are Xstore and Woocommerce.

    Getting this error: “jquery.min.js?ver=3.7.1:2 An invalid form control with name=’cart[3041b624a29b78cd03e5dda98f917661][qty_duplicated]’ is not focusable.”

    21 Answers
    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 24, 2024 at 12:52

    <input type="number" id="quantity_66f2a5d9d3ad4" class="input-text qty text" name="cart[3041b624a29b78cd03e5dda98f917661][qty]" value="8" aria-label="Toote kogus" size="4" min="0" max="7" step="1" placeholder="" inputmode="numeric" autocomplete="off">

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 24, 2024 at 15:59

    Hello, Kristjan,

    Thank you for getting in touch with us.

    We recommend activating an alternative theme, specifically the Storefront (default WooCommerce theme), to assist in diagnosing the current issues you are experiencing. You can find and activate this theme by navigating to Appearance > Themes in your dashboard.

    Should the problems be resolved upon activation of the Storefront theme, please kindly record a video demonstrating the resolved functionality and send it to us for further review. However, if the issues persist, it indicates that the problem is not theme-dependent, and we advise you to contact WooCommerce support for additional assistance – https://wordpress.org/support/plugin/woocommerce/

    Thank you for your cooperation.

    Warm Regards,
    The 8Theme Team

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 25, 2024 at 07:06

    Storefront does not have Ajax updating the cart automatically, but it has update cart button and it works just fine.
    Btw. when I added same button with your theme using functions.php, it did not work.

    function add_update_cart_button() {
        // Check if we're on the cart page
        if ( is_cart() ) {
            ?>
            <div class="woocommerce-cart-form__update-cart">
                <button type="submit" class="btn button<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>"><?php esc_html_e( 'Update cart', 'woocommerce' ); ?></button>
            </div>
            <?php
        }
    }
    add_action( 'woocommerce_cart_actions', 'add_update_cart_button' );
    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 25, 2024 at 07:42

    Here is the video

    Files is visible for topic creator and
    support staff only.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    September 25, 2024 at 10:17

    Dear @Kristjan,

    I hope this message finds you well. We have recently reviewed your website and would like to bring a few points to your attention:

    1. Upon inspection, we noticed that there appears to be no option available to add products to the cart for testing purposes.

    2. We observed that the custom Shop page on your website may be restricting the straightforward addition of products to the cart.

    3. If the functionality to add products is enabled only for logged-in users, could you please provide us with the appropriate wp-admin access credentials? This will allow us to further investigate and assist you effectively.

    4. Additionally, if you are utilizing the XStore Cart builder, you have the option to enable the ‘Update Cart’ button display directly from the widget’s settings. For your convenience, here is a direct link to the setting: https://prnt.sc/wFc-nRRuklek. For more detailed guidance on using the Cart Page Builder with Elementor, please refer to our documentation here: https://www.8theme.com/documentation/documentation/xstore-builders/xstore-cart-page-builder-with-elementor/.

    We look forward to your prompt response to facilitate the necessary adjustments. Thank you for your attention to these matters.

    Best Regards,
    Jack Richardson
    8Theme’s Team

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 25, 2024 at 14:41

    Well, I changed other plugins active, that is why there are restrictions.
    Test it with your own simple plain install and you probably get the same results.

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 25, 2024 at 14:43

    And I’m not using cart builder.

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 25, 2024 at 15:26

    Just test it here: https://xstore.8theme.com/elementor2/industrial-power-tools/cart/
    99.99% sure, they same thing will happen.

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    September 26, 2024 at 10:05

    Dear @Kristjan,

    I hope this message finds you well.

    We have not observed the issues you mentioned in our demo environment. However, to assist you further, could you please provide us with a video demonstrating the problem? This will help us in identifying and addressing the issue more effectively.

    Additionally, as per our support policy, we do not offer additional customization services. If you are not prepared to migrate your Cart page to the builder where this option is available, we may be unable to determine the cause of the issue.

    Thank you for your understanding and cooperation.

    Best regards,
    Jack Richardson
    The 8Theme Team

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 06:46

    Are you saying that it is mandatory to use page builder on cart page and it is fine if it currently does not work without it?
    I did upload the video demonstrating the issue, I’m not sure what or how did you test on you demo site as there I cannot test it there myself.
    I’m asking you to test your theme with your plugin on blank WP install. Only plugins installed are Woocommerce and your plugin. It will happen.

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 07:54

    Here is another video.
    Brand new WP install with only woocommerce, elementor and your theme.

    Files is visible for topic creator and
    support staff only.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    September 27, 2024 at 10:28

    Dear @Kristjan,

    I hope this message finds you well. I would like to clarify our previous communication regarding the use of a page builder on the cart page of your website. It is not mandatory to use a page builder; however, if you are considering implementing custom code to add an ‘Update Cart’ button, we recommend using the Cart Page widget. This widget already includes the desired functionality and has been thoroughly tested to ensure it works correctly.

    We have conducted tests on a fresh installation and encountered no issues, as evidenced by the screenshot available here: https://gyazo.com/b7dcb0fd483297a0db5cc91dc86934b9. Consequently, we would like to perform similar tests on your website to better understand the challenges you are facing. Currently, we are unable to make any purchases, even for testing purposes, as shown in these screenshots: https://prnt.sc/4wIuS5qAcLU3 (single product) and https://prnt.sc/NMheHImW-EyM (shop page).

    We suspect there may be issues related to console logs or server configurations on your end. To proceed with a thorough investigation, we kindly request access to your website’s admin panel. Alternatively, if you could guide us on how to complete a purchase on your store, that would also be greatly appreciated.

    Thank you for your cooperation and understanding. We look forward to your prompt response so we can resolve these issues efficiently.

    Best regards,
    Jack Richardson
    8Theme’s Team

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 10:57

    Please test it here, fresh setup: https://test.hilo.ee/

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 10:58

    You are not testing the scenario I have been showing you in 2 videos and in my description.

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 11:00

    The product stock has to be decreased after you added it into cart!
    You put 2 items in cart.
    Another customer buys 1 before you can checkout.
    You end up in the situation that I’m talking about.

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 11:01

    In your video you just change the quantity in cart, but you DO NOT decrease the amount in stock!

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 11:10

    You must have all the items in shopping cart. Lets say 10.
    The stock decreases, because someone buys 2. Now it 8 in stock.
    You still have 10 in your cart.

    Cart wont update.

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 11:16

    They key is that you have more items in cart than there are in stock. Then the update stops working.

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    September 27, 2024 at 11:45

    Dear @Kristjan,

    We apologize for the oversight regarding the stock quantity modifications during our testing phase. We have identified that the issue stems from the duplication of quantity values for display on mobile devices from our code of theme.

    As an immediate remedy, we recommend implementing the following code snippet in your child-theme/functions.php file and then conducting a retest:

    add_filter('woocommerce_cart_item_quantity', function($quantity_html, $cart_item_key, $cart_item) {
        if (strpos($quantity_html, 'quantity_duplicated') !== false) {
            return $cart_item['quantity'];
        }
        return $quantity_html;
    }, 10, 3);

    We have tested this solution, and it successfully resolves the issue after modifying the stock quantity for the product (https://gyazo.com/44d040cc7933de39b3bc83175dfc963c).

    Waiting for your responce once you make a test from your side.

    Thank you for your understanding and cooperation. Should you have any further questions or require additional assistance, please do not hesitate to contact us.

    Best Regards,
    Jack Richardson
    The 8Theme Team

    Avatar: Kristjan_Rebane
    Kristjan
    Participant
    September 27, 2024 at 12:17

    Yes, that helped to fix the issue. Thank you!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 27, 2024 at 14:17

    Dear @Kristjan,

    You’re welcome!

    Warm Regards,
    The 8Theme Team

  • Viewing 22 results - 1 through 22 (of 22 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.