• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

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

ckatlayna16

New member
Mar 16, 2020
12
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:
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
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;
}
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock