• Resolved Chris Whiteley

    (@thewhite)


    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)
  • Plugin Support CartFlows Team

    (@cartflows)

    Hello @thewhite

    Thank you for getting in touch with us!

    That’s odd, CartFlows does not restrict any of the WooCommerce filters from working.

    For further help, you can try using any of the two filters mentioned in the following screenshot.
    https://share.getcloudapp.com/Z4ujLyQm

    I hope this helps you.

    Please let me know how it goes.

Viewing 1 replies (of 1 total)

The topic ‘Update User Meta After Purchase’ is closed to new replies.