Twelve steps to WooCommerce Follow-up Email happiness.
Exact product matches are processed first, followed by always_send product matches.
- Look for specific product matches that are
always_send=off
and email_type!=storewide
- Skip date emails that have send dates in the past
- Store remaining matches sorted by
priority
as $emails
always_send
product matches run through the same process as above but with
always_send
property set to
on
and that matches are stored as
$always_prods
.
All product categories in the given order are pulled and stored in
$all_categories
.
always_send
category emails are loaded first before the category emails with
always_send=off
- Search for emails that matches any of the category in
$all_categories
- Skip date emails that have send dates in the past
- Store remaining matches sorted by
priority
as $always_cats
Before adding all
$always_prods
emails to the queue, the code first checks for and queues
reminder
emails.
After processing and queuing any
reminder
emails, the emails inside
$always_prods
are then inserted into the queue.
This is a straight-forward process of looping through the
$always_cats
array and adding items to the email queue.
- Get the email with the highest priority and insert it into the email queue
- Loop through the other emails and add to queue if the product IDs are the same with the top email
- For the remaining emails, add them to the queue if the scheduled send date is within 60 minutes. Otherwise, ignore the email
- Get the email with the highest priority and insert it into the email queue
- Loop through the other emails and add to queue if the category IDs are the same with the top email
- For the remaining emails, add them to the queue if the scheduled send date is within 60 minutes. Otherwise, ignore the email
A Storewide email will only be processed if no other emails have been queued for a given order. An exception to this rule is if the
always_send
property is set to
on
.
Other plugins or add-ons (e.g. Subscriptions) can prevent FUE from sending any storewide emails for a particular order by hooking to the
fue_order_created
action and returning a boolean
true
.
- Load all storewide emails
- Skip emails that have
exclude_categories
set when an excluded category matches a category in $all_categories
- Also skip date emails that have send dates in the past
- Insert the remaining storewide emails to the email queue
- Loop through the order items and get the number of times the current customer have purchased item
- If it is the first time, load and queue all
first_purchase
emails that matches the current order item ID
- If it is not the first time, load and queue all
product_purchase_above_one
emails that matches the current order item ID
- Loop through the categories and get the number of times the current customer have purchased items under the categories
- If it is the first time, load and queue all
first_purchase
emails that matches the current category ID
- If it is not the first time, load and queue all
product_purchase_above_one
emails that matches the current category ID
If the customer is a first-time purchaser, load all
first_purchase
emails that are
generic
and add them to the queue
Load all
customer
emails and depending on the email triggers, add to the queue all emails that matches the email’s filter (e.g. total purchases > 3).
Load all
customer
email with the trigger
after_last_purchase
and automatically add them all to the email queue.