Applying a Rule to Existing Orders

After creating a rule with the Ablestar Automatic Order Tags app, you can run that rule against existing orders in your store. The backfill process will re-process the orders and apply tags to them as necessary so that all the orders in your store are in a consistent state. This feature is not available on the free plan.

In this article, we'll show how to apply rules to existing orders and discuss some things to keep in mind while re-processing them.

Step 1: Create and Save a Rule

To apply a rule to previous orders, the rule must be saved. If you have any unsaved changes to the rule, you'll need to save them first before continuing:

Step 2: Open up the Apply Rule Window

  1. On the right side of the page in the 'Apply Rule to Previous Orders' box, click Apply Rule 

This will open up a window that allows you to select which orders you want to apply the rule to:

2. Here, you can choose different statuses and dates for the orders to process.

Step 3: Date Filtering

The 'Start Date' and 'End Date' input boxes allow you to enter optional start and end dates for the orders you want to backfill. Several things to keep in mind are:

  • The dates should be in the format YYYY-MM-DD. For example, October 2, 2021, would be written as 2021-10-02.
  • The fields can be left blank. If the start date is blank, all orders from your first order will be processed. If the end date is blank, orders through your more recent order will be processed
  • The dates are inclusive as the start date is 2021-01-01, and the end date is 2021-01-03, all orders placed on January 1, 2, and 3 will be processed
  • The timezone for the dates is the same as your Shopify store

Step 4: Preview Results

  1. After you've selected the filters, click Preview Results.

Depending on the number of orders in your store, this may take a few seconds, but then you'll be shown the number of orders that will be reprocessed:

2. If this looks correct, click on the button again, and the orders will start processing in the background.

You can see which orders have been processed by clicking Activity Log in the left menu.

Notes about Applying a Rule to Existing Orders

There are a few things to keep in mind while reprocessing existing orders. We recommend you read this section carefully to understand how the process works.

Waiting for the Initial Order Analysis to Complete

When you first install the app, we analyze all the orders on your Shopify store. We do this so we can calculate things like the number of orders a customer placed on a certain date, and all data is deleted 48 hours after you uninstall the app.

In order to apply a rule to existing orders, we will need to have completed this analysis. If you've just installed the app and have a large number of orders, you might need to wait for the analysis to complete before reprocessing them.

Order Status and Rule Triggers

When you create a rule, you specify a trigger to determine when the rule is run. This can be something like when an 'Order is Created' or when an 'Order is Fulfilled.' 

When you apply a rule to existing orders, the trigger will be compared to the current state of the order to see if the rule should be applied to that order (at which time the rule conditions will be checked to see if the tags need to be added or removed). 

A few examples might help make this clearer:

  • If you have a rule that has the trigger "Order is Created," it would match against all orders
  • A rule with the trigger "Order is Cancelled" will only be checked against orders in the canceled state
  • The "Order is Partially Fulfilled" trigger will only check orders that are currently in the partially fulfilled state. If an order was in the partially fulfilled state, but now it is completely fulfilled, it would be skipped.

Updating the Tags

If a rule's trigger matches the order (as discussed above) and all the rule's conditions match the order, the app will apply or remove any tags from that rule to the order and/or customer. 

As with the normal process, the app will query the Shopify API directly to retrieve the current tags and then just update the tags of the order or customer. This process usually takes a fraction of a second and will not overwrite any other customer or order attributes.

Testing

We recommend testing the backfill process against a small set of orders first to ensure it works as expected.

If you have any questions about applying a rule to existing orders, please let us know, and we can help explain things further.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us