This topic has 3 replies, 2 voices, and was last updated 9 years by Radu.

  • Author
  • #76445
     lindorfilms
    Participant

    Can you please help me on that. I am trying to setup custom thank you page with this tutorial:
    http://nicolamustone.it/2015/01/21/customize-the-thank-you-page-in-woocommerce/

    But when i add the code, my website and the backend show blank pages.

    Is there any way i can do this?

    Thank you

    #76615
     Radu
    Moderator

    Hi,

    Sorry to say but it takes to much time to test, debug and implement this, try to enable wp debug https://codex.wordpress.org/WP_DEBUG#Usage and see what error it shows.

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #76809
     lindorfilms
    Participant

    Thanks for your reply. I activate debug. I got no warnings. just a blank page.

    #77059
     Radu
    Moderator

    Hi,

    I think you receive the blank page because of this function :

    COPY CODE
    
    add_filter( 'the_content', 'wc_custom_thankyou' );
    function wc_custom_thankyou( $content ) {
        // Check if is the correct page
        if ( ! is_page(3) ) {
            return $content;
        }
    
    	// check if the order ID exists
    	if ( ! isset( $_GET['order'] ) ) {
            return $content;
        }
    
    	// intval() ensures that we use an integer value for the order ID
    	$order = wc_get_order( intval( $_GET['order'] ) );
    
    	ob_start();
    
    	// Check that the order is valid
    	if ( ! $order ) {
            // The order can't be returned by WooCommerce - Just say thank you
            ?><p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), null ); ?></p><?php
        } else {
            if ( $order->has_status( 'failed' ) ) {
                // Order failed - Print error messages and ask to pay again
                /**
                 * @hooked wc_custom_thankyou_failed - 10
                 */
                do_action( 'wc_custom_thankyou_failed', $order );
            } else {
                // The order is successfull - print the complete order review
                /**
                 * @hooked wc_custom_thankyou_header - 10
                 * @hooked wc_custom_thankyou_table - 20
                 * @hooked wc_custom_thankyou_customer_details - 30
                 */
                do_action( 'wc_custom_thankyou_successful', $order );
            }
        }
    	$content .= ob_get_contents();
    	ob_end_clean();
    	return $content;
    }
    

    Replace the existing function from functions.php with the function above, also replace id 3 with your thank you id page.

    COPY CODE
    
        // Check if is the correct page
        if ( ! is_page(3) ) {
    

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?