Add Missing Last Name
Automatically update Linnworks order customer names when the delivery full name contains only a first name by appending a configured fallback last name.
The Add Missing Last Name macro helps correct Linnworks orders where the customer delivery name contains only one name value.
Some channels may send customer names with only a first name, which can cause issues during shipping label generation, courier validation, or order processing. This macro checks selected orders and updates the customer full name when only one name is present.
When the macro finds an order where the delivery FullName contains only one word, it appends the configured SetLastName value and saves the updated customer information back to the order.
Use this macro to add a fallback last name to selected orders where the customer full name is missing a surname.
Configure the Macro
Once the app is installed, create a macro configuration so the system knows which macro to run and allows it to be selected in the Rule Engine.
This setup can be adjusted anytime based on your operational requirements.
Steps to Configure
Go to Apps > Macro Configuration and click + Add new configuration.

Select the AddMissingLastName macro and click Create Configuration.

This creates a new configuration where the macro can be enabled and used by the Rule Engine.
In the Macro Configuration screen, add the configuration name and parameter value.

Example configuration name:
Add Missing Last Name
Configure the following parameter:
-
SetLastName
Enter the fallback last name that should be added when the customer full name contains only one word.
Example:
John Doe
The selected OrderIds are supplied by the Rule Engine when the macro action runs.
Make sure to enable the macro to continue with the Rule Engine configuration.

Note: If the macro is not enabled, it will not appear in the Action value list when setting up the rule.
Go to Orders > Rules engine and click + Add new rule.

Enter the rule name and click Create.

Click Add new, select Condition, set the condition as required, and save it.


Choose the condition that identifies orders where the customer full name may be missing a last name.
Add the macro action and click Save.


In the Add action window, enter the Action name, for example:
Add Missing Last Name
-
Set Action type to:
Execute a macro -
In Action value, select:
AddMissingLastName -
Click Save
Note: If the macro is not enabled, it will not appear in the Action value list when setting up the rule.
Review the saved rule setup.

-
Verify the condition and action are connected correctly
-
Click Save in the bottom-right corner to save the rule
Customer name accuracy is important for shipping labels, courier validation, and fulfilment workflows. This macro helps reduce manual customer name corrections by automatically appending a fallback last name when only one name is present.
Fix Missing Last Names
Adds a configured fallback last name when the customer full name contains only one word.
Reduce Manual Editing
Helps avoid manually opening orders and updating customer name details one by one.
Support Shipping Labels
Helps ensure the delivery name contains both first name and last name-style values before dispatch.
Use Selected Orders
Processes only the order IDs supplied to the macro by the Rule Engine.
Safe Update Logic
Updates the order only when the full name contains a single name value.
Execution Logging
Logs macro start, order number, customer name, update status, and completion.
How It Works
The macro checks each selected order and updates the customer delivery full name only when the name contains one word.
Step 1
The macro starts execution and writes Macro Start to the log.
Step 2
It loops through each order ID provided in the OrderIds parameter.
Step 3
For each order, the macro retrieves the order details using the Linnworks Orders API.
Step 4
It reads the customer delivery FullName from the order customer address.
Step 5
The macro splits the full name by spaces to check how many name parts exist.
Step 6
If the full name contains only one name part, the macro appends the configured SetLastName value.
Step 7
The macro saves the updated customer information back to the order.
Step 8
If no update is needed, the macro logs Order Info Not Changed.
Step 9
The macro logs any errors and writes Macro Finished when execution ends.
Usage of App
This macro is designed to run against selected orders through the Rule Engine. It is useful when customer names are received without a last name and need a fallback value before dispatch.
OrderIds
Defines the Linnworks order IDs that should be processed. These are supplied by the Rule Engine when the macro action runs.
SetLastName
Defines the fallback last name that should be appended when the customer full name contains only one word.
Customer FullName
The macro checks CustomerInfo > Address > FullName to determine whether a last name is missing.
Customer Info Update
When a missing last name is detected, the macro updates the order customer information using the new full name.
Execution Logging
The macro records the order number, customer name, updated name, unchanged orders, errors, and completion in the logs.
Parameter Setup
SetLastName Example
Customer
Key Points to Remember
-
The macro processes only the order IDs provided in OrderIds
-
The SetLastName parameter is required for the fallback last name value
-
The macro checks the customer address FullName
-
If the full name contains only one word, the macro updates it
-
The updated format is:
OriginalName SetLastName -
If the full name already contains more than one word, no update is made
-
The macro saves changes using SetOrderCustomerInfo
-
The macro logs whether the order information was changed or not changed
Once the macro is running, it helps ensure customer names contain a usable last name-style value before fulfilment or dispatch.
What You Can Expect
-
Single-name customers are updated
If the customer full name is only one word, the configured fallback last name is added. -
Existing full names are preserved
If the customer full name already contains multiple words, the order is not changed. -
Customer info is saved automatically
The macro updates the customer information directly on the order. -
Execution is logged
The macro logs the order number, original customer name, updated customer name, unchanged orders, and errors.
Overall Impact
This macro improves customer name completeness, reduces manual corrections, and helps prevent fulfilment or courier issues caused by missing last names.
What To Do After the Macro Runs
After the rule has triggered the macro, review selected orders if needed to confirm that missing last names have been updated correctly.
Steps to Follow
Step 1
Open Linnworks and locate an order processed by the rule.
Step 2
Open the customer or delivery address details.
Step 3
Confirm that a single-name customer has been updated using the configured fallback last name.
Step 4
Confirm that customers who already had more than one name were not changed.
Step 5
Continue with normal order processing, fulfilment, or dispatch.
Why This Matters
Adding a fallback last name helps:
-
Reduce shipping label validation issues
-
Improve customer address completeness
-
Avoid manual order corrections
-
Support courier and fulfilment workflows
-
Keep customer information consistent
Best Practices
To get the most value from this macro, configure the fallback last name carefully and use rule conditions that target only relevant orders.
Recommended Guidelines
-
Use a clear fallback last name
Use a value that makes sense for your operational workflow, such as Customer. -
Run only where needed
Configure Rule Engine conditions so the macro runs only for orders likely to have missing last names. -
Review sample orders first
Test the macro with a small set of orders before using it widely. -
Avoid unnecessary repeated execution
Once the macro adds the fallback last name, the full name will contain two words and will not be changed again by this macro. -
Check courier requirements
Use a fallback value that will be accepted by your shipping or courier workflow.
Troubleshooting
Customer name was not updated
Confirm that the customer full name contains only one word. If it already has multiple words, the macro does not change it.
Fallback last name is missing
Confirm that the SetLastName parameter has a value in the macro configuration.
Wrong fallback value was added
Review the SetLastName parameter and update it to the required value.
Order was not processed
Confirm that the Rule Engine condition matches the order and that the macro action is attached to the rule.
Macro is not visible in the Rule Engine
Confirm that the macro configuration has been created and enabled in Apps > Macro Configuration.
Customer info did not save
Review the macro logs for API errors and confirm the order can be edited.
Example Scenario
If an order has this customer full name:
Original Customer Full Name
John
And the macro parameter is configured as:
SetLastName
Customer
The macro updates the customer full name to:
Updated Customer Full Name
John Customer
What This Means
-
The original customer full name contained only one word.
-
The macro appended the configured fallback last name.
-
The customer information was saved back to the order.
-
The order can continue through normal fulfilment or dispatch.
Summary
The Add Missing Last Name macro checks selected Linnworks orders and updates the customer delivery full name when only one name is present.
It appends the configured SetLastName value, saves the updated customer information, and logs the result.
This helps teams reduce manual name corrections, improve customer address completeness, and support smoother fulfilment and dispatch workflows.