Displaying author profile link option in the customer list
-
Hi,
So I’m trying to add author’s profile link option on the customer’s details list by myself, would appreciate if anyone can help. (That is, to create an option for link to author’s profile like this: example.com/author/username among all other customer details.)
What I’ve achieved so far:
I’m collecting author profile links (example.com/author/username) on the Woocommerce checkout form through hidden field. So basically when checkout form is submitted it saves author profile link:
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_hidden_field', 10, 1 ); function my_custom_checkout_hidden_field( $checkout ) { // Get an instance of the current user object $user = wp_get_current_user(); // The user link $user_link = home_url( '/author/' . $user->user_login ); // Output the hidden link echo '<div id="user_link_hidden_checkout_field"> <input type="hidden" class="input-hidden" name="user_link" id="user_link" value="' . $user_link . '"> </div>'; } add_action( 'woocommerce_checkout_update_order_meta', 'save_custom_checkout_hidden_field', 10, 1 ); function save_custom_checkout_hidden_field( $order_id ) { if ( ! empty( $_POST['user_link'] ) ) update_post_meta( $order_id, '_user_link', sanitize_text_field( $_POST['user_link'] ) ); }
What would be other necessary steps to add this field to customer details in WC product customer list?? And how can I enable this option on the Product Customer List for WooCommerce dashboard?
Thanks
- The topic ‘Displaying author profile link option in the customer list’ is closed to new replies.