Refresh wooCommerce product page on added to cart problem

[eye_row data_cont=”fluid” data_col_nested=”no” data_padding_row=”0,0,0,0″ data_margin_row=”0,0,0,0″ data_bg_type=”classic” data_bg_position=”top center” data_bg_repeat=”no-repeat” data_bg_attachment=”scroll” data_bg_size=”cover”][eye_column data_width=”0-12-0″][eye_text main_tab=”undefined” button_tab_right=”undefined” font_type=”system” font_devices=”undefined” size_xxl_type=”px” size_xxl_px=”1″ size_xl_type=”px” size_xl_px=”1″ size_lg_type=”px” size_lg_px=”1″ size_md_type=”px” size_md_px=”1″ size_sm_type=”px” size_sm_px=”1″ text_align=”left” font_line_height=”undefined” line_height_xxl_type=”px” line_height_xxl_px=”1″ line_height_xl_type=”px” line_height_xl_px=”1″ line_height_lg_type=”px” line_height_lg_px=”1″ line_height_md_type=”px” line_height_md_px=”1″ line_height_sm_type=”px” line_height_sm_px=”1″ font_letter_spacing=”undefined” letter_spacing_xxl_type=”px” letter_spacing_xxl_px=”1″ letter_spacing_xl_type=”px” letter_spacing_xl_px=”1″ letter_spacing_lg_type=”px” letter_spacing_lg_px=”1″ letter_spacing_md_type=”px” letter_spacing_md_px=”1″ letter_spacing_sm_type=”px” letter_spacing_sm_px=”1″ devices=”undefined” padding_row_xl=”0,15px,0,15px” padding_row_lg=”0,15px,0,15px” padding_row_md=”0,15px,0,15px” padding_row_sm=”0,15px,0,15px” bgopt=”undefined” bg_type=”classic” bg_position=”top center” bg_repeat=”no-repeat” bg_attachment=”scroll” bg_size=”cover” heading_css=”undefined” heading_js=”undefined”]

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

[/eye_text][eye_heading type=”h4″ font_weight=”normal” font_style=”normal” text_align=”left” margin_top=”0″ margin_bottom=”0″]One Way[/eye_heading][eye_text main_tab=”undefined” button_tab_right=”undefined” font_type=”system” font_devices=”undefined” size_xxl_type=”px” size_xxl_px=”1″ size_xl_type=”px” size_xl_px=”1″ size_lg_type=”px” size_lg_px=”1″ size_md_type=”px” size_md_px=”1″ size_sm_type=”px” size_sm_px=”1″ text_align=”left” font_line_height=”undefined” line_height_xxl_type=”px” line_height_xxl_px=”1″ line_height_xl_type=”px” line_height_xl_px=”1″ line_height_lg_type=”px” line_height_lg_px=”1″ line_height_md_type=”px” line_height_md_px=”1″ line_height_sm_type=”px” line_height_sm_px=”1″ font_letter_spacing=”undefined” letter_spacing_xxl_type=”px” letter_spacing_xxl_px=”1″ letter_spacing_xl_type=”px” letter_spacing_xl_px=”1″ letter_spacing_lg_type=”px” letter_spacing_lg_px=”1″ letter_spacing_md_type=”px” letter_spacing_md_px=”1″ letter_spacing_sm_type=”px” letter_spacing_sm_px=”1″ devices=”undefined” padding_row_xl=”0,15px,0,15px” padding_row_lg=”0,15px,0,15px” padding_row_md=”0,15px,0,15px” padding_row_sm=”0,15px,0,15px” bgopt=”undefined” bg_type=”classic” bg_position=”top center” bg_repeat=”no-repeat” bg_attachment=”scroll” bg_size=”cover” heading_css=”undefined” heading_js=”undefined”]

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

[/eye_text][eye_heading type=”h4″ font_weight=”normal” font_style=”normal” text_align=”left” margin_top=”0″ margin_bottom=”0″]Another Way[/eye_heading][eye_text main_tab=”undefined” button_tab_right=”undefined” font_type=”system” font_devices=”undefined” size_xxl_type=”px” size_xxl_px=”1″ size_xl_type=”px” size_xl_px=”1″ size_lg_type=”px” size_lg_px=”1″ size_md_type=”px” size_md_px=”1″ size_sm_type=”px” size_sm_px=”1″ text_align=”left” font_line_height=”undefined” line_height_xxl_type=”px” line_height_xxl_px=”1″ line_height_xl_type=”px” line_height_xl_px=”1″ line_height_lg_type=”px” line_height_lg_px=”1″ line_height_md_type=”px” line_height_md_px=”1″ line_height_sm_type=”px” line_height_sm_px=”1″ font_letter_spacing=”undefined” letter_spacing_xxl_type=”px” letter_spacing_xxl_px=”1″ letter_spacing_xl_type=”px” letter_spacing_xl_px=”1″ letter_spacing_lg_type=”px” letter_spacing_lg_px=”1″ letter_spacing_md_type=”px” letter_spacing_md_px=”1″ letter_spacing_sm_type=”px” letter_spacing_sm_px=”1″ devices=”undefined” padding_row_xl=”0,15px,0,15px” padding_row_lg=”0,15px,0,15px” padding_row_md=”0,15px,0,15px” padding_row_sm=”0,15px,0,15px” bgopt=”undefined” bg_type=”classic” bg_position=”top center” bg_repeat=”no-repeat” bg_attachment=”scroll” bg_size=”cover” heading_css=”undefined” heading_js=”undefined”]

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'));
}

[/eye_text][/eye_column][/eye_row]

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>