Plugins that add Woocommerce Order/Customer Information to the Usermeta Fields?

ckatlayna16

New member
Mar 16, 2020
10
3
3
I am really interested in plugins that add more information about a user/customers purchases, etc. To the User Meta Table. Such as Lifetime Value, Customer Total Spent, Total number of orders, etc. I want to sync this more in-depth information to my CRM/Marketing Automation

I have tested a few but they just seem to display things like the Wc_Customer_Total_Spent on the page and not store it as a custom field with the Usermeta.

Do you know of any plugins that add woocommerce information to the UserMeta table, like Total Customer Spent, etc?

This plugin worked really great for me, but I was wondering if there were others out there that weren't made for a Marketing Automation Suite.
 
Last edited:

dannyl

Member
May 7, 2020
85
47
18
I _think_ your relationship model is wrong.... you export your customer's purchases to the crm, and the CRM should make the calculation.
AFAIK there's no plugin that lets you update a user field via a function on a woocommerce order, but its really easy to DIY with.

Im not by a computer so i cant test this, but the code would basically be


PHP:
add_action( 'woocommerce_thankyou', 'save_usermeta_after_checkout', 20 );
public function save_usermeta_after_checkout( $order_id ){

    $order = new WC_Order($order_id);
    $user_id = $order->get_customer_id();

    // now that we have both the order and the user id, we can get whatever info we want. E.g. :
    $custom_meta_value = total_customer_orders_made_last_may_for_products_on_sale( $user_id ) ;

    //Save this to the users custom_meta_field
    update_user_meta( $user_id, 'my_custom_usermeta_field', $custom_meta_value;
}
 
  • Like
Reactions: ckatlayna16

ckatlayna16

New member
Mar 16, 2020
10
3
3
Thank you! I will test this tomorrow. I see what you're saying about the relationship model being wrong. CRM = customer relationship manager, you offload orders there and handle fulfillment.

The plugin I am using (WP fusion) out of the box will only tag an order status and product name when a product is purchased. It will also only pass order ID and subscription ID along with that. But it can sync all sorts of user meta, so using this snippet to pass Total Spent in a user field should work for the purpose.

The CRM I am using is Mautic. I'm not sure how it compares to other CRMs, this is the first one I've used. I'll have to read about some alternatives since syncing the customers orders sounds really nice compared to some of the contact fields in mautic I am using. Haha

I really appreciate this snippet! Thanks again
I _think_ your relationship model is wrong.... you export your customer's purchases to the crm, and the CRM should make the calculation.
AFAIK there's no plugin that lets you update a user field via a function on a woocommerce order, but its really easy to DIY with.

Im not by a computer so i cant test this, but the code would basically be


PHP:
add_action( 'woocommerce_thankyou', 'save_usermeta_after_checkout', 20 );
public function save_usermeta_after_checkout( $order_id ){

    $order = new WC_Order($order_id);
    $user_id = $order->get_customer_id();

    // now that we have both the order and the user id, we can get whatever info we want. E.g. :
    $custom_meta_value = total_customer_orders_made_last_may_for_products_on_sale( $user_id ) ;

    //Save this to the users custom_meta_field
    update_user_meta( $user_id, 'my_custom_usermeta_field', $custom_meta_value;
}
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu