I am not sure if this is in the realm of our support but here is my question. I have created a custom registration field for customers of "customer id" this correlates to the customers id (main identifier) in our accounting software. Do you know how I would code woocommerce to show this on the sales order?. Ideally we would want it to show with the other customer information. This is information generally the customer would not know. we manually input the data when approving a new b2b customer,.
You would need to change "$customer_id = 'TEST'" with your actual data. I don't really know how or where this is stored in your case. If it's stored as user meta data, you can get it with something like this: $customer_id = get_user_meta($user_id, 'meta_key', true);
If this customer ID is a b2bking field, then the meta key will probably be "b2bking_custom_field_1234" where 1234 is the field ID. It can be checked in the wp_usermeta table if you have experience with that sort of thing.
If that doesn't work, would it be possible for you to share a backend login to your site or staging site so we can check directly? Or if you have any error, please send us the error.
I am not sure if this is in the realm of our support but here is my question. I have created a custom registration field for customers of "customer id" this correlates to the customers id (main identifier) in our accounting software. Do you know how I would code woocommerce to show this on the sales order?. Ideally we would want it to show with the other customer information. This is information generally the customer would not know. we manually input the data when approving a new b2b customer,.
Hi there,
You can add the following PHP code snippet to your site:
It will look like this in the order details page:
You would need to change "$customer_id = 'TEST'" with your actual data. I don't really know how or where this is stored in your case. If it's stored as user meta data, you can get it with something like this: $customer_id = get_user_meta($user_id, 'meta_key', true);
If this customer ID is a b2bking field, then the meta key will probably be "b2bking_custom_field_1234" where 1234 is the field ID. It can be checked in the wp_usermeta table if you have experience with that sort of thing.
Let me know if that helps,
Kind regards,
Stefan
thank you i will give that a try. and yes the field is a b2bking custom registration field
ok dumb question, where would I add the code on the site? MY BAD.. figured it out do in snippets.
I cant seem to get this working.
the test one works, when i try the data one. nothing shows. code i am using is
add_action('woocommerce_admin_order_data_after_billing_address', function(){
$customer_id = get_user_meta($user_id, 'b2bking_custom_field_9926', true);
if (!empty($customer_id)){
?>
<p class="form-field form-field-wide"><strong>Customer ID (internal):</strong>
<?php
echo $customer_id;
?>
</p>
<?php
}
});
Hi there,
Please try to replace your current snippet, with the following:
If that doesn't work, would it be possible for you to share a backend login to your site or staging site so we can check directly? Or if you have any error, please send us the error.
Kind regards,
Stefan
yes that one worked. thank you so much!!!