How to sync AC tags when Woocommerce order status is complete
-
Hi,
I’m using WP Fusion Lite + WC + AC. I would like to re-sync the user tags whenever a WC order status is changed to “completed”. This needs to work on both the front-end processing when a user completes payment, or from the WC admin area with an administrator changing the order status to ‘completed’.So I have the below code snippet which I think is close and should work on both backend and frontend, but I just can’t quite get it working and I’m wondering if someone could give me a hint as to what is wrong.
Logic: Get the $order object using the $order_id, and then extract the order’s $user_id. Then call wp_fusion get_tags method for the user.
function func_refresh_ac_tags( $order_id) { $order = wc_get_order( $order_id ); $user_id = $order->get_user_id(); if( $user_id ){ $tags = wp_fusion()->user->get_tags( $user_id, true ); } } add_action( 'woocommerce_payment_complete', 'func_refresh_ac_tags' );
Thanks,
-Norm
- The topic ‘How to sync AC tags when Woocommerce order status is complete’ is closed to new replies.