There is an online store on wordpress+woocommerce , in which there is a problem when switching to an empty recycle bin - the transition page loops and gives the corresponding error. If you put at least 1 product, then there is no looping and everything works out the rules. In the basket settings, the personal account page of the installed Theme My Login plugin is selected, in which the basket shortcode has been added. What could be the reason and how can this be seen and corrected?
|
1 answer
Found a solution! The whole point is that if the basket and design shortcodes are located on the same page, then if the basket is empty (if you go to the design page, the redirect works), this results in a cyclic redirect. Corrected in the function wc_template_redirect (), which is located in
\woocommerce\includes\wc-template-functions.php this piece is removed
// When on the checkout with an empty cart, redirect to cart page elseif ( is_page( wc_get_page_id( 'checkout' ) ) && sizeof( WC()->cart->get_cart() ) == 0 && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) { wp_redirect( get_permalink( wc_get_page_id( 'cart' ) ) ); exit; } explained in detail with the decision on the forum here
- upvote is the same wordpress ... - Naumov
- It is clear with the decision. But the question remains, how will this plugin update happen after? - E_p
- @E_p you can redefine the function via
functions.php- the link above tells about it or use the paid plugin - ibid. Vasya
|