I have done an integration from WooCommerce to MailRelay. In WooCommerce I choose order-create. I select the fields (email and billing first name) and the customer data chosen in these fields is recorded on the MailRelay platform.
Now, on the WooCommerce “account” page, a form appears to register as a customer, with only the email and password fields. From functions.php I create a new field for the customer name:
with the woocommerce_register_form_start hook I create a new field:
I register and validate the field with the woocommerce_register_post hook and save it using the woocommerce_created_customer hook.
It should be said that all of this, at the level of WordPress and WooCommerce, the code works correctly. The first_name is saved in both WordPress and WooCommerce.
In Bit Integrations, I want to do an integration from customer-create to MailRelay. In the fields section, I match email (form fields) with email (mailrelay fields), and first name (form fields) with name (mailrelay fields).
On the MailRelay platform, only the email field appears registered. The name field is not recorded. Remains empty. How can I correct this?
Could you please let us know where you created the “First Name” field? You mentioned that you created it from functions.php, but we couldn’t locate it. Could you please provide the URL path so we can check it?
Additionally, we would like to inform you that Bit Integration currently supports default user registration fields.
The “First Name” field is created in functions.php, in child theme, in localhost for test. The WooCommerce form to create a new customer does not have a “First Name” field by default.
With code above, a new field is created in WooCommerce account page, register new customer section. The value entered in the field is saved as the First Name, both in the WooCommerce customer data and in the First Name of the WordPress user data.
In the Bit Integrations Field Map drop-down, the First Name field can be selected. I have tested Email (works) and Nickname (works). But if I select First Name, nothing appears in subscriber name in MailRelay platform.
We have checked the issue and noticed that the user’s first name is being updated, which is why the first name field is not sending the data.
The code you are using to create the first name updates the customer details after the account is created. When an account is created from the “My Account” page, the customer is initially created without a first name. Your code then updates the customer with the first name, which is causing the issue.
To resolve this, you need to update your code to include the first name when creating the customer. Alternatively, you can use the “Customer-Edit” trigger in WooCommerce, which should work as expected.
Please note that whenever a user is created, the data will be sent to MailRelay.
How could I update my code to include the first name when creating the customer?
Please note that whenever a user is created, the data will be sent to MailRelay
If a user is created with a form where the first name field alredy exists (my code provides a “first name” field on the customer creation form), shouldn’t the value of that field be sent to MailRelay, regardless of whether it is updated or not?
The code you are using for “First Name” inserts the value into the WordPress user to update the first name field. It doesn’t insert the value when the user is created; it inserts the value after the user has been created.
You can use the “Customer-Edit” trigger in WooCommerce to send data to MailRelay, as it sends data after updating the first name. However, please note that when you edit any customer in the WordPress backend, it will also send data for the customer, as the trigger is “Customer-Edit.”
Please note that whenever a user is created, the data will be sent to MailRelay
It is the same field mapping process. Simply select “First Name” from the drop-down and map it with the Mailrealy “Name” field as you would with any other field mapping