• Resolved bud8ie

    (@bud8ie)


    Hello,

    I have an issue that when I update the quantity on my store from the cart page and hit “Update Cart”, it is moving the page downwards towards the footer. Ideally, I’d like the page to update the quantity/totals and not move anywhere, thus retaining the same view.

    I have very little experience with anything beyond html/css, hence why I’ve hit a wall.

    Thanks for your help.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @bud8ie. Are you referring to the autoscrolling? If so, that would be in one of the WooCommerce JavasScript files, although I’m not sure which one. I know that woocommerce.js (full path wp-content/plugins/woocommerce/assets/js/frontend/woocommerce.js) has the scroll_to_notices function that handles autoscrolling for much of the front end, so that is likely involved somehow. I see that this function is called in a couple of places in cart.js (same folder as above) that do seem to be involved with cart updates.

    I would start by searching for scroll in cart.js and working backwards from there if @arslion’s solution doesn’t work.

    Thread Starter bud8ie

    (@bud8ie)

    Thank you both for your help. I’ve used @arslion’s solution and it appears to have worked, albeit also removing the cart update messages which I would have liked to have kept. So I’ve temporarily removed it for now.

    @apmwebdev, I’ve tried having a look in the cart.js and found three instances of “scroll” but I’m totally unsure as to what might need changed or deleted.

    After searching, I found a possible option at https://frique.me/blog/prevent-automatic-scrolling-to-checkout-error-in-woocommerce/ that prevents scrolling after every ajax request, but I’m not sure as to where this code would actually be placed, or if it would need to be added with every plugin update.

    Thanks again for your help (and time!).

    Hi @bud8ie.

    > I’ve tried having a look in the cart.js and found three instances of “scroll” but I’m totally unsure as to what might need changed or deleted.

    I haven’t dug into this part of the code too much, unfortunately. Questions like this are officially outside of scope for our support, so it’s not something I’m super familiar with. For starters, I would try commenting out just the lines in cart.js that call the scroll_to_notices function. That might be enough by itself. The downside of this is that it would get overwritten when the plugin is updated.

    > After searching, I found a possible option at https://frique.me/blog/prevent-automatic-scrolling-to-checkout-error-in-woocommerce/ that prevents scrolling after every ajax request, but I’m not sure as to where this code would actually be placed, or if it would need to be added with every plugin update.

    This approach is less targeted, but it also has the benefit that you can add it as a stand-alone snippet so that it doesn’t get overwritten when you update the WooCommerce plugin. The easiest way to add this would be with a code snippet plugin, such as Code Snippets. There is a sample JS snippet in there that shows you the format for adding a custom JS snippet of your own. This would probably be the better approach.

    Thread Starter bud8ie

    (@bud8ie)

    @apmwebdev, I’ll give the Code Snippets solution a go. Thank you for taking the time to help – appreciate it!

    Sure thing @bud8ie! Let us know if that doesn’t work!

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any further questions!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Updating Cart, Moves Page’ is closed to new replies.