Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  25] [ 6]  / answers: 1 / hits: 7184  / 4 Years ago, mon, may 25, 2020, 12:00:00

I am new to WordPress and I am using WooCommerce for a online store. I have found a small issue on one of the plugins that i needed for a specific product, and now I shall need to refresh the page automatically after adding the product on cart.



How can I easily do it without compromise the whole store? Is there anyway I can achieve this?



I did try to search for the origin php or js for add to cart event, but I couldn't find anything, and afterwards I tried to add a location.reload() to the add to cart class but it didn't solve my problem as well. This is everything i've tried so far.


More From » php

 Answers
2

Maybe this will work for you. It will refresh your page when the add to cart button is clicked. Add it to your functions.php



add_action('woocommerce_add_to_cart', 'refresh_function');

function refresh_function(){
header(Refresh:0);
}

[#3702] Friday, May 22, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jackelyn

Total Points: 303
Total Questions: 103
Total Answers: 102

Location: Turks and Caicos Islands
Member since Sun, Mar 7, 2021
3 Years ago
jackelyn questions
Thu, Apr 8, 21, 00:00, 3 Years ago
Sun, Feb 28, 21, 00:00, 3 Years ago
Thu, Apr 30, 20, 00:00, 4 Years ago
Fri, Mar 27, 20, 00:00, 4 Years ago
;