Skip Navigation

[Resolved] Purchase/orders details are missing in my account page when using cred form with

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 3 voices.

Last updated by wilborF 3 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1934329

Purchase/orders details are missing in my account page when using cred form with woocommerce.

We created a registration form with woocommerce product "hidden link" and follow the instruction here

https://toolset.com/course-lesson/charge-users-for-registering-premium-accounts/

Problem Is

frontend view: after the customer registered and paid using cred form with woocommerce. the customer has no purchase/order details in the my account page.

backend view: In the woocommerce > orders the status was complete but the customer mark as guest.

What we need is

woocommerce order details must be tag or mark to the registered user

Can you help us solve this?
Are missing something?
Can you provide a custom function for this?

Website: hidden link

Thanks

#1934821

Hello,

Thanks for the details, I can duplicate the same problem, and it should be able to set the new user as the order's customer without any custom codes, so I have escalated it, will update here if there is any news.

#1935113

Hi

Can you update us as soon as the bugs fixed.

Thanks

#1937451

Our 2nd tier support has provided a workaround for it, you can add below codes into your theme file functions.php:

/**
 * Set the user ID for customer in the order used to charge to register a user
 */
function ts_new_user_id( $data ){
	if( !isset($data['extra_data']['cred_form_id']) || $data['extra_data']['cred_form_id'] != 123){
		return;
	}
    if ( isset( $data['transaction_id'] ) ) {
        $order_id = $data['transaction_id'];
        $user_id = get_post_meta( $order_id, '_cred_post_id', true );
 
        if ( isset( $user_id ) ){
            update_post_meta( $order_id, '_customer_user', $user_id );
        }
    }
}
add_action( 'cred_commerce_after_order_completed', 'ts_new_user_id' );

Please replace 123 with your user form's ID, and test again

#1938295

Hi

We tried the above code and tested it but its not working

Can you confirm that function is working?

Thanks

#1940711

Hi,

Thank you for waiting.

Luo is on vacation so I'll be following up on this ticket.

I've performed some tests on my website and I was able to make this work, using a slightly updated code:


function ts_new_user_id( $data ){
 
    if ( isset( $data['transaction_id'] ) ) {
        $order_id = $data['transaction_id'];
        $user_id = get_post_meta( $order_id, '_cred_post_id', true );
 
        if ( isset( $user_id ) ){
            update_post_meta( $order_id, '_customer_user', $user_id );
        }
    }
}
add_action( 'cred_commerce_after_order_completed', 'ts_new_user_id' );

regards,
Waqar

#1949673

My issue is resolved now. Thank you!