• Resolved alanfi

    (@alanfi)


    Hi, I really appreciate help with the following:

    On the shop page, when I add a product to the cart, the page, before it showed, “View Cart” button next to the Add product button

    See example image
    “View

    Now when I add a product, the “View Cart” button appears, but the page immediately reloads automatically, and when reloading the view product button disappears.

    How can I solve this so that the “View Cart” button appears again on the product that I added to the Cart?

    Or simply
    How do I prevent the shop page refresh when I add a product to the cart?

    Thank you very much

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Tseten a11n

    (@tibetanitech)

    I understand when you add the product in the cart, the page reloads and the view cart button disappears.

    It is possible that you’ve disabled the Enable AJAX add to cart buttons on archives option in WP-Admin > WooCommerce > Settings > Products. Please enable and see if that helps. If not, could you please share a copy of your site’s System Status to understand how your site is configured? You can find it via WooCommerce > Status.
    Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.

    Thread Starter alanfi

    (@alanfi)

    Thank you very much for the reply

    I solved the problem

    It is some line of the following code

    jQuery(document).ready(function($){
    // Custom jQuery goes here
    //Uses passive listeners to improve scrolling performance
    (function() {
    var supportsPassive = eventListenerOptionsSupported();

    if (supportsPassive) {
    var addEvent = EventTarget.prototype.addEventListener;
    overwriteAddEvent(addEvent);
    }

    function overwriteAddEvent(superMethod) {
    var defaultOptions = {
    passive: true,
    capture: false
    };

    EventTarget.prototype.addEventListener = function(type, listener, options) {
    var usesListenerOptions = typeof options === ‘object’;
    var useCapture = usesListenerOptions ? options.capture : options;

    options = usesListenerOptions ? options : {};
    options.passive = options.passive !== undefined ? options.passive : defaultOptions.passive;
    options.capture = useCapture !== undefined ? useCapture : defaultOptions.capture;

    superMethod.call(this, type, listener, options);
    };
    }

    function eventListenerOptionsSupported() {
    var supported = false;
    try {
    var opts = Object.defineProperty({}, ‘passive’, {
    get: function() {
    supported = true;
    }
    });
    window.addEventListener(“test”, null, opts);
    } catch (e) {}

    return supported;
    }
    })();
    //end Uses passive listeners to improve scrolling performance

    });

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘“View Cart” button disappears’ is closed to new replies.