Update User Meta After Purchase
-
I have function created that updates the customer user meta after purchasing using the woocommerce_thankyou action. After moving to Cartflows, this function no longer works.
This is the function:
add_action( 'woocommerce_thankyou', 'bw_checkout_save_user_meta' ); function bw_checkout_save_user_meta( $order_id ) { $order = new WC_Order( '$order_id' ); $user_id = $order->get_user_id(); $items = $order->get_items(); foreach ( $items as $item ) { $product_id = $item['product_id']; if ( $product_id == '968' ) { update_user_meta( $user_id, 'course-test', 'Available' ); } } }
It seems that Cartflows uses a bit of a different checkout system. Do I need to be using a different action? or perhaps something other than the order_id?
Any guidance would be greatly appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Update User Meta After Purchase’ is closed to new replies.