Skip to content

Automation

SpecCart includes powerful automation features to streamline your prescription lens workflow and reduce manual intervention.

SpecCart automates these key processes:

  1. Auto-Hold: Orders awaiting prescriptions automatically placed on hold
  2. Auto-Release: Verified prescriptions automatically release orders to processing
  3. Reminder Scheduling: Automatic prescription reminder emails at set intervals
  4. Auto-Cancel: Optional automatic cancellation of long-abandoned orders
  5. Lab Email Notifications: Auto-send order details to lab on verification

When a customer selects “Send Later” for their prescription, SpecCart automatically:

  1. Sets Order Status: Changes order to On Hold immediately after payment
  2. Generates Magic Link: Creates secure 7-day upload token
  3. Sends Initial Reminder: Emails customer with magic link and upload instructions
  4. Sets Metadata: Flags order as awaiting prescription
  5. Adds Order Note: Documents hold reason for staff reference

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 Note

SpecCart prevents payment gateways from overriding the On Hold status:

  • Standard gateways: Prevented from setting “Processing” or “Completed”
  • Cash on Delivery: Forced to “On Hold” for send-later orders
  • Direct bank transfer: Remains “On Hold” until prescription verified

This ensures orders stay held regardless of payment method.

When an admin verifies a prescription, SpecCart automatically:

  1. Checks Order Status: Confirms order is currently On Hold
  2. Verifies Hold Reason: Confirms hold was for prescription (not other reasons)
  3. Checks Payment: Ensures order is fully paid
  4. Releases Order: Changes status to Processing
  5. Sends Confirmation: Emails customer that order is moving forward
  6. Clears Flags: Removes “awaiting prescription” metadata

Auto-release only occurs when all of these are true:

  • Order status is On Hold
  • Order was held specifically for prescription (_speccart_awaiting_prescription = yes)
  • Prescription is marked as verified
  • Order payment is complete (order->needs_payment() = false)

If prescription is verified but payment is pending:

  1. Order remains On Hold
  2. Order note added: “Prescription verified but order still needs payment. Will process once paid.”
  3. Auto-release triggers when payment completes
  4. No customer email sent until order is released

Reminders are sent automatically on a scheduled basis.

Default reminder intervals:

  • Day 0: Initial reminder (sent immediately when order placed)
  • Day 3: First follow-up reminder
  • Day 7: Second follow-up reminder
  • Day 14: Third follow-up reminder

After day 14, no additional automatic reminders are sent.

  1. Daily Cron Job: Runs at 9:00 AM server time
  2. Query Orders: Finds all orders with _speccart_awaiting_prescription = yes
  3. Calculate Days: Determines days since order placed or hold date
  4. Check Counter: Reads current reminder count from order meta
  5. Send if Due: Sends reminder if days match schedule and counter matches
  6. Increment Counter: Updates reminder count in order meta

Each reminder includes:

  • Customer’s order number
  • Days since order placed
  • Magic link for secure upload (regenerated with 30-day expiration)
  • Alternative submission methods (email, fax)
  • Contact information for support

Reminders use WordPress cron:

Event: speccart_send_prescription_reminders Frequency: Daily Time: 9:00 AM server time Next Run: Shows in Tools > Cron Events (with WP Crontrol plugin)

To verify cron is working:

  1. Install WP Crontrol plugin
  2. Navigate to Tools > Cron Events
  3. Find speccart_send_prescription_reminders
  4. Check “Next Run” timestamp
  5. Click “Run Now” to test manually

Optionally auto-cancel orders where customers never send prescriptions.

Currently configured via database option:

update_option( 'speccart_auto_cancel_enabled', 'yes' );
  • Enabled: Default is enabled
  • Cancel After: 30 days without prescription
  • Applies To: Only orders with _speccart_awaiting_prescription = yes
  • Cron Schedule: Daily at 10:00 AM
  1. Daily Cron: Runs at 10:00 AM server time
  2. Query Orders: Finds orders on hold awaiting prescription
  3. Check Age: Calculates days since order placed or hold date
  4. Cancel if Old: Changes status to Cancelled if ≥30 days
  5. Add Metadata: Flags order as auto-cancelled with timestamp
  6. Trigger Email: WooCommerce sends order cancelled email to customer

Order note added:

Order auto-cancelled - No prescription received after 30 days.

Auto-cancel does not automatically refund payments. Store owner must:

  1. Review cancelled orders periodically
  2. Process refunds manually via WooCommerce
  3. Or configure auto-refund via WooCommerce settings

SpecCart automatically sends order details to your lab when prescriptions are verified.

Configure lab email settings at SpecCart > Settings > General > Lab Email Settings:

  • Enable/Disable: Toggle automatic lab emails on/off
  • Lab Email Addresses: Configure one or more lab email addresses
  • Email Format: Structured for lab fulfillment systems
  • PDF Attachments: Optionally attach prescription files

When a prescription is verified:

  1. Trigger: Prescription verification action fires
  2. Email Generated: System compiles order details, lens configuration, and prescription data
  3. Attachment Added: Prescription file (if uploaded) attached as PDF
  4. Email Sent: Sent to configured lab email address(es)
  5. History Tracked: Email send event logged in order meta

Lab emails include:

  • Complete order details (order number, customer info)
  • Full lens configuration (type, material, coatings, tints, add-ons)
  • Prescription data (OD/OS values, PD, prescription type)
  • Customer information for lab reference
  • Prescription file attachment (if uploaded)

Magic links are automatically managed:

Tokens are generated:

  • When customer selects “Send Later” (initial order)
  • When admin clicks “Send Reminder” (regenerated)
  • When link expires and reminder is sent (regenerated)
  • Expiration: 7 days from generation
  • Status: Tracked as Active, Expired, or Used
  • Regeneration: Automatic when reminder sent after expiration

Tokens include:

  • Cryptographically random string
  • Order ID association
  • Expiration timestamp
  • Single-use flag (marked used after upload)

Planned settings UI at SpecCart > Settings > Automation:

  • Enable/disable automatic reminders
  • Customize reminder schedule (days)
  • Set maximum reminder count
  • Customize reminder email content
  • Enable/disable auto-hold
  • Customize hold reason note
  • Set initial reminder timing
  • Enable/disable auto-release
  • Require manual release (override)
  • Set release conditions
  • Enable/disable auto-cancel
  • Set cancellation threshold (days)
  • Enable auto-refund
  • Customize cancellation email

Track automation performance:

View at SpecCart > Dashboard:

  • Orders awaiting prescription (count)
  • Average verification time
  • Reminder emails sent (last 30 days)
  • Auto-released orders (last 30 days)
  • Auto-cancelled orders (total)

Each order stores automation metadata:

  • _speccart_awaiting_prescription: Yes/no flag
  • _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

Check these issues:

  1. Cron not running: Verify WordPress cron is active
  2. Event not scheduled: Check Tools > Cron Events
  3. Email disabled: Check WooCommerce > Settings > Emails > Prescription Reminder
  4. Order not flagged: Verify _speccart_awaiting_prescription = yes in order meta
  5. Reminder limit reached: Check reminder count (max 3 automatic)

If orders stay On Hold after verification:

  1. Payment incomplete: Check order payment status
  2. Hold reason different: Verify order was held for prescription
  3. Meta flag not cleared: Check _speccart_awaiting_prescription is deleted
  4. Hook not triggering: Verify speccart_prescription_verified_notification hook fires

If orders don’t hold automatically:

  1. Payment gateway override: Check gateway priority
  2. Hook conflict: Disable other order status plugins
  3. Send Later not detected: Verify prescription method in order meta
  4. Already verified: Check if prescription marked verified during checkout

If WordPress cron is unreliable:

  1. Disable WP cron: Add to wp-config.php:
    define('DISABLE_WP_CRON', true);
  2. 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
  3. Verify timing: Check cron runs consistently
  4. Monitor logs: Install WP Crontrol to view execution history

Recommended automation setup:

  1. Enable all automation: Auto-hold, auto-release, reminders
  2. Configure email templates: Customize reminder content
  3. Set up monitoring: Track dashboard statistics
  4. Test workflow: Create test orders through complete cycle
  5. Train staff: Ensure team understands automation behavior

For reliable reminder delivery:

  1. Use SMTP plugin: Configure transactional email service
  2. Authenticate domain: Set up SPF, DKIM records
  3. Monitor bounces: Check email logs for failures
  4. Test spam scores: Send to various email providers
  5. Avoid spam triggers: Review email content

Set expectations with customers:

  1. Checkout notice: Inform about reminder schedule
  2. Order confirmation: Explain prescription requirement
  3. Reminder emails: Include support contact information
  4. Cancellation warning: Notify of auto-cancel policy (if enabled)