> ## Documentation Index
> Fetch the complete documentation index at: https://docs.highailabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Managing Shops

> Save the dispensaries you use, link order history, and understand which shop fields make Gmail discovery and Quick Sync work.

## Overview

Saved shops connect purchase history, spending totals, visit tracking, Gmail
receipt discovery, and the Shopping Agent. In the app and code these records
are called dispensaries; user-facing screens may call them Shops.

<Info>
  [Order Activation](/help/user-flows/order-upload) is the source of truth for
  how shops interact with Gmail, text order review, and durable order saving.
</Info>

## Add a shop

Open **Shops & Dispensaries** and choose **Add**. The current full form supports:

| Field                     | Required now | Used for                                            |
| ------------------------- | -----------: | --------------------------------------------------- |
| Name                      |          Yes | Display, exact-name order linking, and search       |
| Up to five menu URLs      |           No | Shopping workflows                                  |
| Address, city, state, ZIP |           No | Shop detail and directions                          |
| Phone                     |           No | Contact action                                      |
| Email                     |           No | Contact information and a receipt-domain suggestion |
| Website                   |           No | Website action and a receipt-domain suggestion      |
| Notes                     |           No | Personal reference                                  |
| Up to ten receipt domains |           No | Targeted Gmail discovery and Quick Sync             |

Name is the only required field. Gmail can open this setup inline so a user can
save where they shopped and confirm a receipt sender domain without abandoning
the import flow.

## Email fields and Gmail readiness

The backend stores two different concepts:

* `email`: a contact address or domain-like value.
* `emailDomains`: one or more normalized sender domains used by Quick Sync.

The main Add/Edit form manages both. Contact email or website may suggest a
domain, but that domain is not Gmail search scope until the user confirms it.
Confirmed domains normalize, validate, deduplicate, and can be removed.

The Gmail wizard provides the same lightweight setup inline. It saves or
enriches the shop, then rescans only the newly confirmed domain.

## How orders link to shops

When a text or Gmail order is committed with a dispensary name, the server:

1. uses a requested owned dispensary ID when one is supplied;
2. otherwise searches the user's shops by exact name;
3. creates a name-only shop if no exact match exists;
4. stores the shop ID and display name on the order; and
5. reserves a durable visit effect that increments visit count and last visit.

The shared text/Gmail Review & Confirm screen provides friendly shop selection
and correction before save. Editing a saved order to a genuinely different
historical shop label detaches a stale `dispensaryId` instead of attributing the
purchase to the wrong managed shop.

## Gmail-created shops

Gmail order confirmation can create a shop from the reviewed dispensary name,
record a visit, and attach the validated sender domain. The shop is then ready
for targeted future Quick Sync.

## Edit, favorite, view history, and delete

From the shop list or detail screen, users can:

* edit the fields supported by the full form;
* favorite or unfavorite a shop;
* open its website, location, or menu links when present;
* view orders linked by `dispensaryId` and spending totals; and
* delete the saved shop after confirmation.

Deleting a shop removes its Convex dispensary record. Existing orders retain
their stored dispensary name and are atomically detached from the deleted shop
ID. The current delete path does not merge the shop into another record.

## Onboarding status

The onboarding question **Where do you usually shop?** currently searches a
small mock list and saves only the onboarding answer. It does not create a
Convex dispensary and does not provide Gmail with a usable domain.

Gmail's activation path already uses a real saved-shop flow and asks for a
confirmed receipt sender domain before its default targeted scan. The standalone
onboarding picker remains preview-only.

## Current limitations

* Domains are user-confirmed but do not yet carry a separate ownership or
  confidence score.
* Exact-name backend upsert can produce variants instead of a merged record.
* No merge-duplicate-shops action.
* Deleting a shop does not offer to reassign historical orders first.

<CardGroup cols={2}>
  <Card title="Order Activation" icon="receipt" href="/help/user-flows/order-upload">
    See the complete shop, Gmail, text, strain, and save contract.
  </Card>

  <Card title="Gmail Sync" icon="envelope" href="/help/features/gmail-sync">
    Connect Gmail and review candidate receipts.
  </Card>

  <Card title="Dispensary Flow Map" icon="diagram-project" href="/help/user-flows/dispensary-management">
    A concise lifecycle diagram that points back to the canonical flow.
  </Card>

  <Card title="Shopping Agent" icon="cart-shopping" href="/help/features/shopping-agent">
    Use saved menu URLs for shopping workflows.
  </Card>
</CardGroup>
