• NameRequired

    (@agustin8_4)


    I have 2 problems.

    1) Some how the backend of woocommerce got broken:

    When a go into product:

    The display to edit the product information is all messed up in one long page intead of multiple tabs. Also I can`t delete or add gallery photos.

    Here is a screenshot: https://oficina.com.py/wp-content/uploads/2014/02/problem.png

    2) After check out, there are errors, so it redirects to the cart (and erases the cart) instead of redirecting to the thank you page.

    I know where to look for the fix but my knowledge is not enough

    I get the information even after the wrong redirect after errors, so I just need to redirect to a page that says thank you, but I cant even do that with this code:

    // Redirect to success/confirmation/payment page
    					if ( $result['result'] == 'success' ) {
    
    						$result = apply_filters( 'woocommerce_payment_successful_result', $result, $order_id );
    
    						if ( is_ajax() ) {
    							echo '<!--WC_START-->' . json_encode( $result ) . '<!--WC_END-->';
    							exit;
    						} else {
    							wp_redirect( $result['redirect'] );
    							exit;
    						}
    
    					}
    
    				} else {
    
    					if ( empty( $order ) )
    						$order = new WC_Order( $order_id );
    
    					// No payment was required for order
    					$order->payment_complete();
    
    					// Empty the Cart
    					WC()->cart->empty_cart();
    
    					// Get redirect
    					$return_url = $order->get_checkout_order_received_url();
    
    					// Redirect to success/confirmation/payment page
    					if ( is_ajax() ) {
    						echo '<!--WC_START-->' . json_encode(
    							array(
    								'result' 	=> 'success',
    								'redirect'  => apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order )
    							)
    						) . '<!--WC_END-->';
    						exit;
    					} else {
    						wp_safe_redirect(
    							apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order )
    						);
    						exit;
    					}
    
    				}
    
    			} catch ( Exception $e ) {
    
    				if ( ! empty( $e ) )
    					wc_add_notice( $e->getMessage(), 'error' );
    
    			}
    
    		} // endif
    
    		// If we reached this point then there were errors
    		if ( is_ajax() ) {
    
    			ob_start();
    			wc_print_notices();
    			$messages = ob_get_clean();
    
    			echo '<!--WC_START-->' . json_encode(
    				array(
    					'result'	=> 'failure',
    					'messages' 	=> $messages,
    					'refresh' 	=> isset( WC()->session->refresh_totals ) ? 'true' : 'false',
    					'reload'    => isset( WC()->session->reload_checkout ) ? 'true' : 'false'
    				)
    			) . '<!--WC_END-->';
    
    			unset( WC()->session->refresh_totals, WC()->session->reload_checkout );
    			exit;
    		}
    	}

    Someone knows how to redirect this code to a single page when the result has error (failure)?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Mike Jolley

    (@mikejolley)

    You need to get your GATEWAY updated for 2.1 support, don’t hack WC core files!

    Thread Starter NameRequired

    (@agustin8_4)

    That′s actually 2.1 Gateway, I just don`t know what is causing the error, so Im trying to patch it until next update.

    Also, I don`t know what is causing the product informations tabs to display like that, is not a plugin nor a theme conflict. I′m thinking that my tables got messed up.

    Mike Jolley

    (@mikejolley)

    What gateway is it? 2.1 or not, its probably not compatible ??

    Thread Starter NameRequired

    (@agustin8_4)

    Thats part of class-wc-checkout.php woocommerce 2.1.1

    is not compatible, but do you know how to make the redirect?

    Mike Jolley

    (@mikejolley)

    I want to know what PAYMENT GATEWAY you are using. Thats what I think is not compatible.

    Thread Starter NameRequired

    (@agustin8_4)

    Im using Custom Payment plugin to add more options, but I still think that a readirect would be the easiest solution right now, the problem will take a long time to find

    Mike Jolley

    (@mikejolley)

    Well then you need to edit Custom Payment plugin and replace all instances of “get_permalink” with the correct endpoints. And report this to the author or “Custom Payment plugin”.

    the pay page endpoint can be retrieved with:

    $order->get_checkout_payment_url( true );

    The thanks page endpoint should be retrieved with:

    $this->get_return_url( $order )

    These changes were announced months ago.

    S R

    (@the-goshorn-9)

    I’m having a similar problem.
    See my site here: https://heartspectrum.com/shop

    My primary source of payment is Paypal. But there isn’t even a Checkout button on the Cart page! So how can a person checkout?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Plugin Woocommerce 2.1.2’ is closed to new replies.