Tag orders based on line item properties - with date reformatting
Line item properties are custom form fields that you can add to your product pages allowing customers to make choices or add information to create a customized product, or to apply certain instructions related to that product in their order.
Line item properties can also be added to the cart by third-party apps, such as date pickers, e.g. to allow the customer to choose the delivery date.
Example of a line item property
This is a very basic example of a date being selected and captured on a product page:
A date picker will usually be presented where a date is the value to be captured:
The line item property will be visible within the cart before placing the order:
You will also see the line item property during checkout:
Once the order has been placed, the line item property (name and value) will appear under the product/variant title:
Why is this criteria useful?
Our Line item properties contain a date value you would like to reformat criteria (catchy isn't it...) is specifically targeted at line item properties that have a date as the value.
Often, the format of the date in the line item property value is not in an acceptable format to be applied as a tag. Some 3rd party logistics companies, for example, need the date to be in a specific format, or the date contains a comma, which can not be used in an order tag.
Our Line item properties contain a date value you would like to reformat criteria will allow you to reformat the date and even apply an offset to that date if required (e.g. +2 days or -3 days) before then applying it as a tag on your order.
Please Note:
This criteria will not reformat the original line item property date, it will only reformat the date to be applied as a tag on the order.
Setting up the workflow
To create a workflow using this criteria, click on the Create New Workflow button from the main Workflows view:
Define the trigger to determine at which point you would like the workflow to run, we recommend selecting the trigger when orders are created.
Click the Add criteria to my workflow button:
The Line item properties contains a date value you would like to reformat criteria can be found within the Order category in the Select criteria pop-up window:
You will then be presented with the following customisable fields:
Criteria fields
Let's take a look at each of the fields within this criteria and find out how they can be configured:
- Line item property
- Date format of the line item property
- Adjust by days (optional)
- Prefix
- Date format required for the tag
- Suffix
Line item property
This field allows you to define the name of the line item property that contains a date value.
You may need to take a look at some of your existing orders to find the exact name of the line item property.
When configuring this field, please ensure that the line item property name is entered exactly as it appears in your orders, observing where there are capital letters, spaces and any special characters such as hyphens or underscores.
Date format of the line item property
This field requires that you select the format of the date that appears as the line item property value.
In the example already shown above, we can see that the date format of the delivery date line item property is MM/DD/YYYY.
The available date format options are as follows:
Select the option that matches the line item property value date format.
Adjust by days (optional)
If you need to apply an offset to that date before then applying it as a tag on your order, e.g. plus or minus a few days, then we have an optional field called Adjust by days that can do just that.
For example, if your line item property value was 28-05-2020 and you wanted to add 3 days to the date that gets applied as the tag, then you'd configure the field to 3:
This would apply a tag of 31-05-2020 to the order.
If you wanted to subtract 6 days to the date that gets applied as a tag, then you'd configure the field to -6:
This would apply a tag of 22-05-2020 to the order.
Tag Prefix
This option will also allow you to specify a Prefix as the first part of the tag before the date or day. This can help to identify what the tag is related to. You can use a prefix to identify what the date tag relates to, for example
- Shipping Date: 02/01/2021
- Delivery Date: 02/01/2021
- Order Date: 02/01/2021
This is especially useful if you are applying multiple date tags to your orders and need to be able to filter them by meaning.
Date format required for the tag
This field allows you to select the format that you'd like the date to be in when it is applied to your order as a tag. The available date format options are as follows:
Tag Suffix
This option will also allow you to specify a Suffix as the last part of the tag after the date or day. Similar to the Prefix, this can help to identify what the tag is related to.
Example
Let's say you'd like to customise this criteria to apply a tag based on a line item property where the name of the property is deliveryDate and the value is 02/10/2021, with the following settings:
- offset the date by minus 2 days
- change the date format from MM/DD/YYYY to DD-MM-YYYY
- add a tag prefix of Delivery Date:
You would need to configure the criteria as follows :
In this example, the tag would appear on the order as:
Delivery Date: 08-02-2021
Naming and saving your workflow
It's worth giving your workflow a name to help you identify it at a later date, so add a workflow name in the New Workflow section, check the summary of your workflow and if happy, either Test your Workflow against an existing order or hit Save Workflow:
Backdating
This criteria option will work if you choose to Backdate your orders.