Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
0 answers
57 views

Set WooCommerce billing country based on WPML current language

I am using the following code to change WooCommerce billing country to the selected site language. add_filter('init', function() { $lang = apply_filters( 'wpml_current_language', NULL ); $...
Nathan Otten's user avatar
0 votes
1 answer
65 views

Use WooCommerce account name and email instead of billing name and email for invoices and email notifications

I want to use the WordPress account User Name on the customer emails and admin order notifications instead of the Billing Name. Our use case is that employees are enrolling for an online course. They ...
Eilonwy926's user avatar
1 vote
1 answer
88 views

Fatal Error when calling woocommerce_customer_save_address action hook

I hope you can help. I am getting a strange issue and not sure how to solve it. I'm familiar with calling actions, but I am getting a fatal error when calling a standard woo hook that is empty. I'm ...
user1518699's user avatar
2 votes
1 answer
97 views

Display user data in a new column on WooCommerce admin order list (+ HPOS)

I want to add my field as new column in all orders table in backend. I have tried the following but its not displaying. Anyone know about this? Please help. // Add custom column to orders list table ...
Amrutha Lakshmi InterSmart's user avatar
0 votes
0 answers
78 views

How to assign an order number as a login password for store users? (WooCommerce)

Good afternoon. I need to change the login method for my Woocommerce store clients. I’m using WooCommerce to book rooms. Is it possible to automatically create a customer account based on one order? I ...
Timofey Golubtsov's user avatar
2 votes
1 answer
364 views

Additional column in WooCommerce admin order list with the user login

I need to add a custom column "Customer" in the backend of WooCommerce orders list. Here is some code that add additional columns to admin orders list and displays the user ID: add_filter( '...
martnek's user avatar
  • 21
0 votes
1 answer
663 views

Auto create an user account after payment and auto login in WooCommerce

After others' previous questions, I have a question here: Automatically create an user account after WooCommerce checkout and auto login First question: How in this section that the message (Thank you....
SubZer0's user avatar
  • 97
0 votes
1 answer
223 views

Copy user meta to order meta on user profile update

I have a user meta field ('pkg_code') I would like to copy to a custom field ('log') on the users' order(s) upon update of their user profile. I have looked through many similar posts on stackoverflow ...
Mandm's user avatar
  • 1
1 vote
1 answer
214 views

Auto redirection in WooCommerce after login based on user meta data

I am trying to check if a user meta data is empty or not. If empty, redirect the user to a page, else redirect to the default page. But my following codes is only redirecting to the default page. ...
KBD's user avatar
  • 43
1 vote
1 answer
4k views

Automatically create an user account after WooCommerce checkout and auto login

The goal here is to automatically create a customer account directly after checkout and auto login. This is the code I am using: add_action( 'woocommerce_thankyou', 'add_as_customer_after_checkout', ...
user avatar
1 vote
2 answers
428 views

Define user variable in WooCommerce My account custom menu item content

The custom menu is displayed in My Account of woocommerce. I am making a custom menu with the code below. /** * Query registration */ function my_custom_query_vars($vars) { $vars[] = 'my-dosu-...
yokoyama's user avatar
2 votes
1 answer
175 views

Add "created by" for every product and coupon etc, in "post_submitbox_misc_actions" box

I was able to write a code which is working fine! I just had some question if this code has a good quality or if I can do it better. We want to display "Created by" on every product edit ...
Nik7's user avatar
  • 386
1 vote
1 answer
300 views

Apply a customer birthday discount based on date custom field in WooCommerce

Based on Only allow edit of custom field once per customer on My account > edit account in WooCommerce answer to my previous question, I am trying to apply a customer birthday discount. Here is my ...
user avatar
1 vote
1 answer
1k views

Check if user is VAT exempt on WooCommerce email notifications

On WooCommerce new order email notification sent to the admin I am trying to display "Tax Free Order" additional text when user "is Vat exempt", using the following: add_action( '...
user29780's user avatar
2 votes
2 answers
1k views

Update WooCommerce User programmatically when creating a user

Im trying to create a new user programmatically trough a form but Im having problem with getting the phone numer and country set trough wp_create_user - why wont it take the values? First and last ...
Jerry's user avatar
  • 1,089
3 votes
1 answer
3k views

Programmatically created WooCommerce order have no tax for new users

Im using Gravity forms to create an WooCommerce order programmatically. If an email added to the form already exists, it takes the shipping and billing from the users account. This works and it adds ...
Jerry's user avatar
  • 1,089
1 vote
1 answer
2k views

How to automatically create an account if a product in the order belongs to a certain category in WooCommerce

I have a WooCommerce shop where customers checkout as guests. I now want to sell a couple of virtual products and in that case I want to auto create an account. So I have two working code snippets. ...
joak's user avatar
  • 19
1 vote
1 answer
146 views

View/update WooCommerce user custom field in admin WP user pages

I've added a custom field in my functions.php using the answer given in this question: Add a custom field in Woocommerce Edit Account page My code for this is: // Add the custom field "ukara"...
Ryan 'Tarquin' Cox's user avatar
6 votes
1 answer
3k views

How to get the total amount spent by a user (customer) in WooCommerce?

With the following shortcode I am trying to get user total spent amount, but it is slowing page load (6 seconds). Is it possible to optimize this code to shorten the loading time? add_shortcode('woo-...
Alexander Pavlov's user avatar
2 votes
1 answer
2k views

Custom VAT field issue in Woocommerce

I use the code below to add a VAT field in woocommerce address. It's works but, it throws this error: Notice: billing_vat est appelée de la mauvaise manière. Order properties should not be accessed ...
microb14's user avatar
  • 483
1 vote
1 answer
605 views

Change sender name to customer billing full name in WooCommerce email notifications

How can I change E-Mail Sender Name into customer “Billing First & Last Name” using woocommerce_email_from_name hook? For Example: "My Shop" should be changed to "John Doe". ...
Nero's user avatar
  • 41
1 vote
1 answer
928 views

Save filtered billing phone to admin user profile in WooCommerce

Everything I have read over the last couple of days has indicated that if I want to save fields in the user-edit.php (User Admin Backend), I should be using the edit_user_profile_update & ...
Aliqua's user avatar
  • 728
1 vote
1 answer
1k views

Passing Custom User Fields to WooCommerce Order Metadata

I'm working on setting up an Woo site that will be integrated with a Sage X3 ERP system. We will be pushing new orders through to Sage. Now I am looking to add a custom ID field for each customer and ...
JonnyBravo's user avatar
3 votes
1 answer
1k views

Add user custom account field to WooCommerce checkout

I have added to admin users a custom meta field using the following code:`` function wporg_usermeta_form_field_birthday( $user ) { ?> <table class="form-table" id="...
aslam shikalgar's user avatar
2 votes
1 answer
630 views

What hook to be used for cancelled booking in WooCommerce Bookings?

I'm trying to make an SQL query to run upon cancellation of a booking, via a custom plugin, updating custom user meta data. Here's my code: function wporg_callback() { global $wpdb; $wpdb-&...
solo22x's user avatar
  • 23
1 vote
1 answer
226 views

Add a purchase condition to WooCommerce products

I ma trying to add a purchase condition to my WooCommerce products with the following: {$current_user = wp_get_current_user(); if ( current_user_can('administrator') || wc_customer_bought_product($...
Lionel Kpanou's user avatar
4 votes
1 answer
6k views

Add birthday field to WooCommerce my account and admin user page

I have added the code below. The birthday field is showing in my account page and also in WP admin user page as well but the problem is that the date is not saving. What I have so far function ...
Awais Asif's user avatar
1 vote
1 answer
433 views

WooCommerce custom plugin: Error around WC_Customer Object instance

I've built a plugin and I have the following issue: The WooCommerce Dashboard (in the admin side) will not load the data. It hangs and fails. I have tracked the problem code: The issue in the if ( ...
Stefan S's user avatar
3 votes
3 answers
7k views

Send an email notification with the generated password on WooCommerce user creation

In WooCommerce with code below I create new WP_User with a random password and set user role to "customer" (I want to create account on purchase automatically). Then I use WC_Emails to send login ...
Karnak's user avatar
  • 113
2 votes
1 answer
3k views

Save custom checkout field value as user data on WooCommerce

I've added a custom checkbox in the checkout page of my WooCommerce shop for the optional newsletter subscription: add_action( 'woocommerce_after_order_notes', 'add_checkout_newsletter_subscribe', 9 )...
Davide's user avatar
  • 87
0 votes
1 answer
61 views

For specific products on WooCommerce orders with completed status, change information from a specific custom page

I am using "For specific products on WooCommerce orders with completed status, perform an action" answer to one of my previous questions. Now I want to show some specific content if the user bought a ...
Beusebiu's user avatar
  • 1,513
-3 votes
1 answer
279 views

Update custom user meta value using checkbox [duplicate]

I am using "Integrate Sendgrid Newsletter Subscription form on WooCommrece Register Page" answer code to one of my previous answers. On Woocommerce account details section of My account page, I have a ...
Jm Cabugnason's user avatar
0 votes
0 answers
154 views

WooCommerce product attributes filter widget - Save value into user meta

Is there a way I can hook into the product attributes drop-down filter widget and save the chosen value into the user meta? I basically want to know what the user's last used filter was so I can ...
Seb G's user avatar
  • 671
1 vote
1 answer
373 views

Add current product to the current logged in user meta data

In WooCommerce product page, I'm trying to add the current product as a new user meta data. Am I doing this right? Then how can I retrieve this product meta data in cart page? // save for later ...
Wani's user avatar
  • 129
3 votes
2 answers
4k views

Update user meta data after Woocommerce new user registration

Im trying to add a custom field to WP_USERMETA table after Woocommerce registration add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1); function wc_assign_custom_role($args) ...
zEn feeLo's user avatar
  • 1,980
1 vote
1 answer
2k views

Update user display name from custom checkout field in WooCommerce

In WooCommerce, at checkout, I am able to create or update all the user and billing information while placing an order. However, I want to set/update the user "display name" (alias) as well. So ...
Roasty's user avatar
  • 57
1 vote
1 answer
482 views

Custom Birth Date field not showing in my account edit details page

I would like to add a birth date field to both checkout and my account edit details page. I followed the suggested code over at this thread here and managed to get the custom field on checkout and ...
Juco's user avatar
  • 13
2 votes
1 answer
4k views

Add a custom Settings tab to Woocommerce Settings for Customer list content

I've managed to put this together even though I do not fully understand it all. The goal is to have a custom tab called "Customer List" and in that tab (WooCommerce Settings -> Customer List) show a ...
user avatar
4 votes
1 answer
5k views

Display user meta data values in admin user list custom columns in WordPress

For Woocommerce, with the help of this answer thread, I created some custom columns in Back end (Admin) user list: In the database, there are some meta_key values called billing_vatnr and ...
user avatar
0 votes
1 answer
2k views

Admin user list custom column display based on custom user metadata in Wordpress

I have created a custom column for WordPress users called "Verification". Upon WooCommerce registration, an email is sent to the user asking them to verify their email and that way, account. This ...
user avatar
1 vote
1 answer
2k views

Keep order billing first and last names auto updated from user data in Woocommerce

So, I have a script that uses WC API to get billing_last_name in another application. I recently added a plugin that lets a user connect to the website via social networks. This creates an account ...
George Imbrea's user avatar
2 votes
2 answers
3k views

Create user on order status completed action hook in WooCommerce 3+

I am trying to create a new user within the woocommerce_order_status_completed hook. add_action( 'woocommerce_order_status_completed', 'custom_woocommerce_order_status_completed', 10, 1 ); function ...
Edin's user avatar
  • 103
1 vote
1 answer
1k views

Adding some my account custom fields to admin user pages in Woocommerce

In another question on here a user asked How to add a custom fields in Edit Account page I am looking to do the same thing but also to add the same custom field on the users profile page where its ...
Rob Hutchison's user avatar
1 vote
1 answer
1k views

How to save and display user meta from Woocommerce order admin

Customers have an extra field called billing_ean as part of their billing address. I'm using the following code to load, edit, and save their EAN number from the Woocommerce single order page in the ...
evox's user avatar
  • 45
2 votes
3 answers
8k views

Get alll customer mobile phone numbers in Woocommerce

I want to loop all the phone numbers of my users into an input field. So far, I'm not getting any luck with the following: <?php for get_user_meta('phone_number',true); { echo $phone; "," } ?> ...
Nathan Winch's user avatar
1 vote
1 answer
403 views

Auto update Wordpress user data when editing their order details in Woocommerce

In Woocommerce Order edit pages, editing the customer order does not update the customer user details in Wordpress user data. Is it possible to automatically save customer details after editing the ...
Nicu Zecheru's user avatar
1 vote
1 answer
1k views

Display customer phone in "New Order" Woocommerce email notifications

In WooCommerce, How can we show the Telephone number of a customer in "New Order" email notifications?
Mohammad Badawy's user avatar
5 votes
1 answer
5k views

Sync additional Billing registration fields with default Wordpress fields in WooCommerce

I Have added the below codes into Woocommerce user registration form to get the Billing Details on the registration page. Now what is happening when a new user register, the first and last name will ...
Adnan Ali's user avatar
0 votes
1 answer
2k views

Display the customer phone in WooCommerce new account email notification

How can I display Phone number in new account registration email? I have add Phone number field like: <p class="form-row form-row-wide"> <label for="reg_billing_phone">Phone <span ...
Ansarul Haque's user avatar
1 vote
1 answer
118 views

Add user´s Bio in woocommerce email notifications

In my WooCommerce web site, I am trying to add the user Biography. Any Idea on how can I add the user´s Bio in Woocommerce emails notifications?
Dino9's user avatar
  • 95