Automation
SpecCart includes powerful automation features to streamline your prescription lens workflow and reduce manual intervention.
Automation Overview
Section titled “Automation Overview”SpecCart automates these key processes:
- Auto-Hold: Orders awaiting prescriptions automatically placed on hold
- Auto-Release: Verifying a prescription moves an order SpecCart is holding for it to Processing
- Reminder Scheduling: Automatic prescription reminder emails at set intervals
- Auto-Cancel: Automatic cancellation of long-abandoned orders, on unless you turn it off
- Lab Email Notifications: Auto-send order details to lab on verification
- Fitting Photo Links (Measurements module): Emailed when an order with a fitting height to be sent later reaches Processing
Auto-Hold on Order Creation
Section titled “Auto-Hold on Order Creation”When a customer selects “Send Later” for their prescription, SpecCart automatically:
- Sets Order Status: Changes order to On hold immediately after payment
- Generates Magic Link: Creates secure 7-day upload token
- Sends Initial Reminder: Emails customer with magic link and upload instructions
- Sets Metadata: Flags order as awaiting prescription
- Adds Order Note: Documents hold reason for staff reference
How It Works
Section titled “How It Works”The auto-hold process:
Customer Checkout (Send Later) ↓Payment Complete ↓SpecCart Intercepts Status Change ↓Generates Magic Link Token ↓Sets Order Status: On Hold ↓Sends Initial Reminder Email ↓Adds Order NotePayment Gateway Compatibility
Section titled “Payment Gateway Compatibility”SpecCart prevents payment gateways from overriding the On hold status:
- Standard gateways: Prevented from setting “Processing” or “Completed” on a Send Later order
- Cash on Delivery: Forced to “On hold” for send-later orders
- Direct bank transfer and cheque: WooCommerce holds these orders until the payment arrives, and a verify leaves them On hold (see below)
This ensures orders stay held regardless of payment method. Other lens orders are never moved straight to “Completed” by a gateway: they go to “Processing”.
When a Prescription Arrives Through an Upload Link
Section titled “When a Prescription Arrives Through an Upload Link”The customer’s emailed link opens a secure upload page at /prescription-upload/. There they can:
- Upload File: a JPG, PNG or PDF of up to 5MB, dragged in or chosen (Take Photo on a phone). With AI extraction switched on the file is read, and the customer checks the values before submitting. Without it the file is not read, and the customer picks their PD from a list (“Your prescription is uploaded. Please add your PD to continue.”) and clicks Submit Prescription
- Enter Manually: type the prescription, with the same ranges as the wizard
Under the default PD requirement, Required, must be filled in, a PD is required on every route: the submit is held with “Please enter your PD to continue.” until there is one. Under Optional the customer can submit without one (the upload notice reads “Your prescription is uploaded. Add your PD if you know it.”), but half of two PD values is held with “Enter both PD values, or untick the box, to continue.” and a typed prescription that is all 0.00 with “Enter your prescription, even if it is 0.00, to continue.” Under Required with a default each PD list on the page rests on “63 (average)” with “63 is an average PD, not your own. If you know yours, choose it from the list, even if it is 63.” under it, the upload shows no PD notice, and the submit is not held for a single PD: a list the customer leaves alone is recorded as the shop’s default, and a single 63 they choose is recorded as their own. See Prescription settings. If a file cannot be read, or the read comes back with every value empty, the page says “We couldn’t read your prescription. Upload a clearer photo or choose Enter Manually to type it in.”; if a link has had its five uploads, “Too many uploads for this link. Try again in an hour, or choose Enter Manually to type it in.”; if the upload fails, “Your prescription was not uploaded. Check your connection and upload it again.”; if the submit fails, “Your prescription was not sent. Check your connection and submit it again.”
A link works once and for 7 days. An expired link shows Link Expired with a Request a New Link form, where the customer enters their email address and order number to be sent a new link. An address can request three links an hour, and each link takes five uploads an hour, counted from the first one.
When the prescription is submitted:
- The prescription is attached to the order and its status becomes Received
- The link is marked used
- The order gets the note “Prescription received via secure upload link.” If prism entry is switched on and the prescription shows a prism, it also gets “The uploaded prescription shows a prism. Check it before making the lenses.”
- The order status follows the setting When a prescription arrives through an upload link at SpecCart > Settings > Prescription:
- Move the order to Processing at once (the default): an order On hold moves to Processing. The customer reads “We have your prescription. Your order is now being processed.”
- Keep the order On hold until staff have checked it: the order stays On hold until staff verify the prescription. The customer reads “We have your prescription. Our team will check it, then your order will be processed.”
Auto-Release on Verification
Section titled “Auto-Release on Verification”When an admin verifies a prescription, SpecCart automatically:
- Checks Order Status: Confirms order is currently On hold
- Verifies Hold Reason: Confirms SpecCart is holding it for its prescription (not other reasons)
- Checks Payment: Ensures order is fully paid
- Releases Order: Changes status to Processing, and WooCommerce sends the customer its processing email
- Clears Flags: Removes “awaiting prescription” metadata
The Prescription Verified email goes to the customer on every verify, whether or not the order moves.
Release Conditions
Section titled “Release Conditions”Auto-release only occurs when all of these are true:
- Order status is On hold
- SpecCart is holding it for its prescription: a Send Later order still awaiting it (
_speccart_awaiting_prescription = yes), or an order kept On hold after its prescription arrived through an upload link (_speccart_prescription_hold = yes) - Prescription is marked as verified
- Order payment has been received, or the order is Cash on delivery
The check is made before the verify is saved, so it works the same from the order screen, the Prescriptions screen and the Mark Rx Verified bulk action. An order On hold for any other reason, such as a hold staff set by hand, is verified and stays On hold.
Handling Unpaid Orders
Section titled “Handling Unpaid Orders”If prescription is verified but payment is pending (a bank transfer or cheque, say):
- Order remains On hold
- Order note added: “Prescription verified but order still needs payment. Will process once paid.”
- SpecCart does not release it later: set the order to Processing once the payment has arrived
- The Prescription Verified email is still sent
Prescription Reminder Automation
Section titled “Prescription Reminder Automation”Reminders are sent automatically on a scheduled basis.
Reminder Schedule
Section titled “Reminder Schedule”Default reminder intervals:
- Day 0: Initial reminder (sent immediately when order placed)
- Day 7: Second reminder
- Day 14: Third reminder
After the third reminder, no additional automatic reminders are sent. Manual reminders count towards the three.
How Reminders Work
Section titled “How Reminders Work”- Daily Cron Job: First scheduled for 9:00 AM the day after activation, then daily
- Query Orders: Finds orders On hold or Pending payment with
_speccart_awaiting_prescription = yesand no verification - Calculate Days: Determines days since hold date (or order date)
- Check Counter: Reads current reminder count from order meta
- Send if Due: Sends reminder if days match schedule and counter matches
- Increment Counter: Updates reminder count in order meta when the email is sent
Reminder Email Content
Section titled “Reminder Email Content”Each reminder includes:
- Customer’s order number
- Magic link for secure upload (a new 7-day link each time; the previous link stops working)
- An invitation to reply to the email with a photo or scan of the prescription
- Order details
Cron Configuration
Section titled “Cron Configuration”Reminders use WordPress cron:
Event: speccart_send_prescription_reminders
Frequency: Daily
Time: 9:00 AM
Next Run: Shows in Tools > Cron Events (with WP Crontrol plugin)
To verify cron is working:
- Install WP Crontrol plugin
- Navigate to Tools > Cron Events
- Find
speccart_send_prescription_reminders - Check “Next Run” timestamp
- Click “Run Now” to test manually
Auto-Cancel Abandoned Orders
Section titled “Auto-Cancel Abandoned Orders”Orders where customers never send prescriptions are cancelled automatically.
Turning Auto-Cancel Off
Section titled “Turning Auto-Cancel Off”Auto-cancel is on unless the database option says otherwise. There is no settings screen for it. To turn it off:
update_option( 'speccart_auto_cancel_enabled', 'no' );Auto-Cancel Settings
Section titled “Auto-Cancel Settings”- Enabled: Default is enabled
- Cancel After: 30 days without prescription
- Applies To: Only orders On hold or Pending payment with
_speccart_awaiting_prescription = yes - Cron Schedule: Daily at 10:00 AM
Auto-Cancel Process
Section titled “Auto-Cancel Process”- Daily Cron: Runs at 10:00 AM
- Query Orders: Finds orders on hold awaiting prescription
- Check Age: Calculates days since order placed or hold date
- Cancel if Old: Changes status to Cancelled if ≥30 days
- Add Metadata: Flags order as auto-cancelled with timestamp
- Trigger Email: WooCommerce sends its cancelled order email
Cancellation Note
Section titled “Cancellation Note”Order note added:
Order auto-cancelled - No prescription received after 30 days.Refunds
Section titled “Refunds”Auto-cancel does not automatically refund payments. Store owner must:
- Review cancelled orders periodically
- Process refunds manually via WooCommerce
- Or configure auto-refund via WooCommerce settings
Lab Email Automation
Section titled “Lab Email Automation”SpecCart sends order details to your lab when staff click Send to lab on the Prescriptions screen, and, if you choose, when prescriptions are verified.
Configuration
Section titled “Configuration”Configure lab email settings at SpecCart > Settings > General, under Lab email settings:
- Lab email addresses: One or more addresses the lab PDFs are sent to
- Auto-send to lab when prescription is verified: Email the lab automatically when staff verify a prescription
- Email subject: Placeholders
{order_number},{customer_name}and{order_date}
How It Works
Section titled “How It Works”When a prescription is verified with auto-send switched on:
- Trigger: Prescription verification action fires
- Check: Skipped if no lab addresses are set or the order has already been sent to the lab
- PDF Generated: A lab PDF is generated for each lens item that does not already have one
- Email Sent: Sent to configured lab email address(es) as a plain-text email with the PDFs attached
- History Tracked: The order note “Lab order email sent to: [addresses]” is added, and the Prescriptions screen shows when and by whom it was sent
If an automatic send fails, the order gets the note “Auto-send lab email failed: [reason]”.
The Lab PDF
Section titled “The Lab PDF”Each lens item’s lab PDF holds:
- Order number, date and customer details
- Frame and lens details (usage, varifocal type, colour, package, add-ons)
- The prescription for each eye: SPH, CYL, AXIS, prism, ADD (Int) and ADD (Near)
- Measurements for each eye: PD Dist, PD Near and Height
- The prescription’s notes
The PD is read from the order: two PD values print as the customer gave them, right and left. A single PD prints against each eye according to Single PD on the lab PDF at SpecCart > Settings > Prescription, Lab PDF:
- Half against each eye (31.5 and 31.5), the default
- The whole PD against each eye (63 and 63)
When the line has no PD, No PD given is printed under the measurements table, and when the PD is the shop’s default (see Prescription settings), “Shop default, not chosen by the customer” is printed there in the same small text, and the PD cells print 63 as for any PD. Neither line is printed together with the other, and a PDF made before staff add a PD is remade when they save it.
The near PD prints the same way when the order has one; otherwise the PD Near cells repeat the distance PD. With the Measurements module switched on, Height carries the segment height for the order’s PD from the fitting photo; it is blank otherwise.
An existing PDF is reused, so after editing a prescription click Regenerate PDF on the Prescriptions screen before sending. A fitting photo arriving through a link rebuilds the PDF by itself.
Magic Link Token Management
Section titled “Magic Link Token Management”Magic links are automatically managed:
Token Generation
Section titled “Token Generation”Tokens are generated:
- When customer selects “Send Later” (initial order)
- With every reminder from the daily check
- When admin clicks Regenerate & Email New Link (shown once the link has expired)
- When the customer requests a new link from the expired-link page
Each new token replaces the previous one, which stops working.
Token Expiration
Section titled “Token Expiration”- Expiration: 7 days from generation
- Status: Tracked as Active, Expired, or Used
- Regeneration: A new link is sent with each reminder from the daily check
Token Security
Section titled “Token Security”Tokens include:
- Cryptographically random string, stored only as a hash
- Order ID association
- Expiration timestamp
- Single-use flag (marked used after upload)
Opening the page with a wrong or used link is limited to ten failed tries per visitor in five minutes.
Fitting Photo Links (Measurements Module)
Section titled “Fitting Photo Links (Measurements Module)”With the Measurements module switched on, when an order reaches Processing and a varifocal, bifocal or occupational line’s fitting height was left to be sent later, the customer is emailed one link per such line to take the fitting photo. This happens once per order. If the email cannot be sent, the order gets the note “The fitting photo email could not be sent to [email]. Check the shop’s email settings.”
Monitoring Automation
Section titled “Monitoring Automation”Track automation performance:
Prescriptions Screen
Section titled “Prescriptions Screen”View at SpecCart > Prescriptions:
- Orders by prescription status, with a count of those pending
- Days each prescription has been waiting
- Whether each order has been sent to the lab
Order Meta Tracking
Section titled “Order Meta Tracking”Each order stores automation metadata:
_speccart_awaiting_prescription: Yes/no flag_speccart_prescription_hold: Kept On hold after an upload link arrival, until verified_speccart_prescription_reminder_sent: Reminder count_speccart_prescription_reminder_dates: Array of send dates_speccart_hold_date: When order was held_speccart_initial_reminder_sent: Initial reminder flag_speccart_auto_cancelled: Auto-cancel flag_speccart_lab_email_sent: When the order was sent to the lab_speccart_fitting_links_sent: Fitting photo links sent (Measurements module)
Troubleshooting Automation
Section titled “Troubleshooting Automation”Reminders Not Sending
Section titled “Reminders Not Sending”Check these issues:
- Cron not running: Verify WordPress cron is active
- Event not scheduled: Check Tools > Cron Events
- Email disabled: Check WooCommerce > Settings > Emails > Prescription Reminder
- Order not flagged: Verify
_speccart_awaiting_prescription = yesin order meta - Reminder limit reached: Check reminder count (three, the first and any manual ones included)
Orders Not Auto-Releasing
Section titled “Orders Not Auto-Releasing”If orders stay On hold after verification:
- Payment incomplete: Check order payment status
- Hold reason different: Verify order was held by SpecCart for its prescription
- Upload link setting: Under Move the order to Processing at once, an order whose prescription came through a link has usually moved already; check its notes
- Order notes: Look for “Prescription verified but order still needs payment. Will process once paid.”
Auto-Hold Not Working
Section titled “Auto-Hold Not Working”If orders don’t hold automatically:
- Payment gateway override: Check gateway priority
- Hook conflict: Disable other order status plugins
- Send Later not detected: Verify prescription method in order meta
- Already verified: Check if prescription marked verified during checkout
Cron Not Running
Section titled “Cron Not Running”If WordPress cron is unreliable:
- Disable WP cron: Add to
wp-config.php:define('DISABLE_WP_CRON', true); - Set up server cron: Add to crontab:
Terminal window */15 * * * * wget -q -O - https://yoursite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1 - Verify timing: Check cron runs consistently
- Monitor logs: Install WP Crontrol to view execution history
Best Practices
Section titled “Best Practices”Automation Workflow
Section titled “Automation Workflow”Recommended automation setup:
- Check the defaults: Auto-hold, release on verify and reminders always run; auto-cancel runs unless you turn it off
- Configure email templates: Customise reminder content
- Set up monitoring: Check the Prescriptions screen daily
- Test workflow: Create test orders through complete cycle
- Train staff: Ensure team understands automation behaviour, in particular that Verify can move an order to Processing and send the customer’s processing email
Email Deliverability
Section titled “Email Deliverability”For reliable reminder delivery:
- Use SMTP plugin: Configure transactional email service
- Authenticate domain: Set up SPF, DKIM records
- Monitor bounces: Check email logs for failures
- Test spam scores: Send to various email providers
- Avoid spam triggers: Review email content
Customer Communication
Section titled “Customer Communication”Set expectations with customers:
- Checkout notice: Inform about reminder schedule
- Order confirmation: Explain prescription requirement
- Reminder emails: Include support contact information
- Cancellation warning: Notify of auto-cancel policy (if enabled)
Related Topics
Section titled “Related Topics”- Review Order Workflow for complete process
- Configure Email Notifications
- Learn Prescription Verification best practices