Refresh wooCommerce product page on added to cart problem

Refresh your page when the add to cart button is clicked. Add it to your functions.php / plugin

One Way

add_action('woocommerce_add_to_cart', 'refresh_function');
   function refresh_function(){
   header("Refresh:0");
}

Another Way

add_action('woocommerce_add_to_cart_redirect', 'refresh_function');
function refresh_function($url = false) {
   // If another plugin beats us to the punch, let them have their way with the URL
   if(!empty($url)) { return $url; }
   // Redirect back to the original page, without the 'add-to-cart' parameter.
   // We add the `get_bloginfo` part so it saves a redirect on https:// sites.
   return get_bloginfo('wpurl').add_query_arg(array(), remove_query_arg('add-to-cart'));
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>