FEATURE GUIDES

FreshGuard AI โ€” Feature Guides

Detailed explanations of every FreshGuard AI feature. Use the navigation below to jump to any section.

โฐ

Expiry Pre-Actions

Configure automated rules that trigger a set number of days before a batch expires. For example, trigger 30 days before expiry to send an alert or apply a discount, then trigger again at 7 days for a deeper discount. This creates a progressive markdown strategy that maximises revenue recovery from perishable stock.

Go to Preferences โ†’ Batch Expiry to set the number of days before expiry and whether to automatically remove batch quantities from Shopify inventory when the date passes. Discount sync and tag sync are available as manual actions from the Preferences page. Click "Run Discount Sync Now" or "Run Tag Sync Now" to execute them on demand.

๐Ÿ“‹

Batch History & Audit Log

FreshGuard automatically logs every significant batch event into a searchable audit trail stored in your Shopify shop-level metafields. Navigate to Batch History in the sidebar to view the full timeline.

Event types tracked:

  • batch_created โ€” A new batch was added via the Products page or CSV import.
  • batch_deducted โ€” Quantity was deducted via FEFO when a customer placed an order.
  • batch_expired โ€” The batch reached its expiry date and was automatically marked Expired.
  • batch_updated โ€” A batch's quantity or metadata was manually adjusted.

Each event records: timestamp, batch number, quantity change (ยฑ), associated order ID, and a descriptive note. The log retains the last 500 events and can be searched by batch number, action type, or order ID. Click on any batch in the Inventory Batches tab to jump straight to its history.

๐Ÿท๏ธ

Automated Discount Strategies

Pro Plan feature. In Preferences โ†’ Batch Discounts, set two values: the number of days before expiry to trigger a discount, and the percentage to discount. Then click "Run Discount Sync Now".

FreshGuard scans all active batches, identifies those expiring within your threshold, and automatically creates Shopify Price Rules for the associated product variants. The price rules are set to auto-expire on the batch's expiry date so you never need to manually clean them up.

๐Ÿ’ก Tip: Set a 30-day trigger at 10% off and a 7-day trigger at 25% off by running the sync twice with different settings. This creates a tiered clearance funnel.

๐Ÿท๏ธ

Automated Product Tagging

FreshGuard can automatically apply the Expiring Soon tag to Shopify products when their oldest active batch is within your configured expiry threshold. This lets you build dynamic Shopify collections (e.g., a "Clearance Sale" page) that automatically populate with at-risk inventory.

The Products page includes a "Discounted" tab that filters to show only products with batches expiring within 30 days.

Go to Preferences โ†’ Automated Product Tagging and click "Run Tag Sync Now" to apply tags immediately. The tag is removed automatically once all batches for that product are no longer within the expiry window.

๐Ÿ””

Staff Email Notifications

Configure who gets notified in Preferences โ†’ Staff Notifications. Enter one or more email addresses separated by commas.

Email notification digests are coming in a future update. Currently, you can monitor expiry status from the Dashboard and Analytics pages.

  • Batch quantities are fully depleted (inventory reaches zero).
  • A batch officially crosses its expiry date.
  • A batch enters the "Expiring Soon" threshold window (Pro only).
๐Ÿ”„

Inventory Sync

FreshGuard can optionally write batch quantity changes back to Shopify's live inventory system. When enabled in Preferences โ†’ Inventory, any time you add a new batch or adjust a batch's quantity, the change is immediately reflected in Shopify's inventory count for that product variant at the selected location.

This prevents overselling by ensuring your store's available quantity stays in sync with actual batch-level stock. When adding a batch, check "Adjust quantity in Shopify" in the batch modal to apply the sync for that specific entry.

๐Ÿ“ฌ

FEFO Order Deduction & Order Metafields

FreshGuard listens to the orders/create Shopify webhook. When a customer places an order, FreshGuard automatically:

  1. Identifies which line items are tracked by FreshGuard.
  2. Sorts all active batches for that product by earliest expiry date (FEFO logic).
  3. Deducts the ordered quantity from the soonest-expiring batch first.
  4. Tags the Shopify order with the Batch Number (e.g., Batch:LOT-2026A).
  5. Writes a consumed_batches metafield on the order for traceability and packing slip integration.

You can also manually allocate batches to orders using the "Auto Allocate" button on the Orders page. This runs the FEFO algorithm on-demand for a specific order.

โš ๏ธ Important: If an order is cancelled or refunded after batch deduction, inventory is NOT automatically restored to the batch. You must manually re-adjust the batch quantity in FreshGuard.

๐ŸŒ

Storefront Expiry Date Display

Show customers the expiry date of the current batch on your product pages. FreshGuard exposes a secure App Proxy endpoint that your theme can call to retrieve live expiry data.

Step 1: In your Shopify theme editor, open the product page template and add this Liquid + JS snippet:

<div id="freshguard-expiry" data-variant-id="{{ product.selected_or_first_available_variant.id }}">
  <p id="freshguard-expiry-text" style="color: #6b7280; font-size: 0.9rem;"></p>
</div>

<script>
  document.addEventListener('DOMContentLoaded', function() {
    var el = document.getElementById('freshguard-expiry');
    var variantId = el ? el.getAttribute('data-variant-id') : null;
    if (!variantId) return;
    fetch('/apps/freshguard/expiry?variant_id=' + variantId)
      .then(function(r) { return r.json(); })
      .then(function(data) {
        if (data.expiry_date) {
          var d = new Date(data.expiry_date);
          var label = 'Best before: ' + d.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' });
          if (data.days_remaining <= 30) label += ' โš ๏ธ Expiring soon!';
          document.getElementById('freshguard-expiry-text').textContent = label;
        }
      });
  });
</script>

Step 2: The endpoint /apps/freshguard/expiry?variant_id=XXXXX returns JSON: { expiry_date, batch_number, days_remaining, is_expiring_soon }

๐Ÿ–จ๏ธ

Packing Slip Batch Data

Include batch/lot numbers and expiry dates on printed packing slips so warehouse staff have a physical record of which batch was shipped. FreshGuard stores this data as an Order Metafield that Shopify's packing slip template can read.

Step 1: In Shopify Admin, go to Settings โ†’ Shipping and delivery โ†’ Packing slips โ†’ Edit template.

Step 2: Add this inside the line items loop:

{%- assign batch_data = order.metafields["$app:inventory"]["consumed_batches"].value -%}
{%- if batch_data -%}
  {%- for batch in batch_data -%}
    {%- if batch.variantId == line_item.variant.id -%}
      <p style="font-size: 11px; color: #666; margin: 2px 0;">
        Lot: {{ batch.batchNumber }} | Expiry: {{ batch.expiryDate }}
      </p>
    {%- endif -%}
  {%- endfor -%}
{%- endif -%}
๐Ÿšจ

Batch Recall & Traceability

If you need to recall a batch due to contamination, quality failure, or regulatory requirement, use FreshGuard's Recall Report tool to instantly identify every affected customer.

  1. Go to Recall Report in the FreshGuard sidebar.
  2. Select the batch or lot number from the dropdown.
  3. The report shows every order and customer (name + email) who received that batch.
  4. Click Export Customer List (CSV) to download a file for outreach or regulatory submission.

โš ๏ธ Prerequisite: FEFO Order Deduction must have been active when orders were placed so FreshGuard could record which batch went to which order via the consumed_batches order metafield.

โ† Getting Started TutorialTechnical Documentation โ†’

ยฉ 2026 Sumadroid ยท Privacy Policy ยท sumadroid.com