• Resolved bhranch

    (@bhranch)


    I am wanting to put the customers name & personalize it, also I am using the plugin Snippet’s and that is where I put it. I seen in this forum a post from a couple years ago a link you all had listed (https://www.tychesoftwares.com/how-to-customize-the-woocommerce-thank-you-page/). It listed this css:

    <?php
    
    add_filter( 'the_title', 'woo_personalize_order_received_title', 10, 2 );
    function woo_personalize_order_received_title( $title, $id ) {
        if ( is_order_received_page() && get_the_ID() === $id ) {
    	    global $wp;
    
            // Get the order. Line 9 to 17 are present in order_received() in includes/shortcodes/class-wc-shortcode-checkout.php file
            $order_id  = apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order-received'] ) );
            $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) );
    
            if ( $order_id > 0 ) {
                $order = wc_get_order( $order_id );
                if ( $order->get_order_key() != $order_key ) {
                    $order = false;
                }
            }
    
            if ( isset ( $order ) ) {
                //$title = sprintf( "You are awesome, %s!", esc_html( $order->billing_first_name ) ); // use this for WooCommerce versions older then v2.7
    	    $title = sprintf( "You are awesome, %s!", esc_html( $order->get_billing_first_name() ) );
            }
        }
        return $title;
    }
    
    add_filter('woocommerce_thankyou_order_received_text', 'woo_change_order_received_text', 10, 2 );
    function woo_change_order_received_text( $str, $order ) {
        $new_str = $str . ' We have emailed the purchase receipt to you.';
        return $new_str;
    }

    Here is the way it said it will show: https://cdn2.tychesoftwares.com/wp-content/uploads/2017/05/14070456/woocommerce_change_thank_you_text.png

    I put this code in the plugin Snippets and here is what I get:
    There is no customers name like it says it would, it is not reading any of the top code. It is only recognizing the bottom one (Thank you. Your order has been received. We have emailed the purchase receipt to you.). How can I get my Order Received Thank You Page to look like what they show ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Thu P. a11n

    (@thup90)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce Order Received/Thank You Page – Help’ is closed to new replies.