# Shop — an online shop with PromptPay

> The official Shop plugin — add products, place add-to-cart buttons in the designer, a cart and checkout with a PromptPay QR for the exact amount, bank transfer, cash on delivery, slip upload and order management

Source: https://anasaki.live/docs/en/store/plugin-shop

The **Shop** plugin (`eshop`) lets your site sell right away: add products in the admin, customers add them to the cart, enter their address and pay with **a PromptPay QR with the amount filled in**, a bank transfer or cash on delivery. The shop checks the slip and changes the status on the **Orders** page, and the system emails the customer.

Needs Anasaki Studio 2.2.2 or later.

## Getting started

1. Install **Shop** from the Plugin Store and activate it
2. Go to **Plugins → Shop → Settings** and enter at least one payment method
3. A **Products** menu appears in the admin — add a product with a price, featured image and description, then publish
4. Open `/product/` to see the price and the **Add to cart** button under the description

## Settings

| Setting | Meaning |
| --- | --- |
| PromptPay | A 10-digit phone number, 13-digit ID number or 15-digit e-Wallet — empty = no PromptPay |
| PromptPay account name | Shown under the QR so customers can check before paying |
| Bank transfer account | Bank, account number, account name — empty = no transfer option |
| Accept cash on delivery | Turn the COD option on/off |
| Shipping / free shipping from | Shipping per order and the minimum total for free shipping (0 = no free shipping) |
| New order notification email | Empty = the administrator email (set up the site's **Email** first) |
| Cancel unpaid orders after | Hours (default 48), stock is returned automatically — not COD orders or orders with a slip attached |
| Show the price and add-to-cart button under the product description | Switch off if you place an **Add to cart** block in your own product template |

## Products

Product fields: **price** (required), **sale price** (shows the old price struck through), **stock** (empty = not tracked) and **SKU**. Stock goes down when the customer confirms an order and comes back on cancellation; sold-out products show **Sold out** instead.

Products can use categories, and each has its own page at `/product/`, using the post template or the one chosen under **Site settings → Display → Content types from code**.

### Options, galleries, discount codes (1.1)

- **Options** — set an **Option name** (e.g. Size) and add rows to the options list, each with its own name, price and stock (empty price = the product price, empty stock = not counted). Customers pick one before adding to the cart; sold-out ones are disabled; the price reads &#34;From ฿…&#34; when they differ
- **More photos** — up to 12, shown on the product page with a large view
- **Discount codes** — the **Discount codes** setting, one per line: `CODE | 10% or an amount | minimum order | last day`, e.g. `WELCOME | 10%` or `SAVE100 | 100 | 1000 | 2026-12-31`. With codes, checkout has a code box; the discount shows on the order page, in mails and in the CSV
- **Prices on cards** — product cards in lists (the **Fields** block) show the price; the product page has its own price box and button

## In the designer

**Plugin blocks** (Elements tab):

- **Add to cart** — choose the product in the properties panel, or leave it empty inside a product template or a product list card; choose whether to show the price and a quantity box
- **Cart link** — a 🛒 icon with the item count, good for the header
- **Product price** — the price (and the old price when on sale)

**Product lists**: place a **Collection** and choose the data source **Products (shop)**. Use `{{item.title}}` `{{item.image}}` `{{item.price}}` `{{item.regularPrice}}` `{{item.url}}` in the card, and the parameters `search` `category` `sort` (`price`, `-price`, `title`).

## How customers buy

1. Press **Add to cart** — the cart is kept in a browser cookie for 30 days, no sign-up needed
2. `/cart` — change quantities, remove items, see shipping and the total, then press **Checkout**
3. `/checkout` — enter name, phone, email (optional), address and choose a payment method
4. The order page (`/shop/order/`) shows **the PromptPay QR with the amount** or the account number, with an **Attach slip** box (the image is resized before sending) — the link can be used later to check the status

Prices and stock are always checked again on the server at confirmation, so customers cannot change prices in the browser, and one IP address can place at most 5 orders per minute.

## Managing orders

The **Orders** page (developer menu → plugin pages) lists orders by status. Search by name, phone, email or code, click the number to see the items, address and **slip**, then change the status:

| Status | What happens |
| --- | --- |
| Awaiting payment | The starting status |
| Paid | A payment confirmation email to the customer |
| Shipped | A shipping email to the customer |
| Completed | Done |
| Cancelled | Stock is returned |

Export everything as **CSV**, and the dashboard has a **Shop** card (awaiting payment, to ship, today's sales). The **Manage orders** and **Manage products** permissions are set under **Users → Permissions** (default: administrators and editors).

### Tracking numbers and card payments (1.1)

On an order's page enter the **Carrier** and **Tracking number** and press **Save and mark as shipped**: the customer is mailed the number and sees a **Track the parcel** button (tracking links for Thailand Post, Kerry, Flash and J&T).

With the [Payments](/docs/en/store/plugin-payments) plugin installed, a **Card** payment method appears.

### Receipts, tax invoices and My orders (1.1)

- Set the **seller name, tax ID and address** for receipts; when **VAT registered**, receipts are **tax invoices / receipts** with the amount before VAT and the 7% VAT
- Customers tick **I need a full tax invoice** at checkout and enter the name / company, 13-digit tax ID and address
- A **Paid** order gets a receipt number (`R2026-0001`, counted per year) and a **Receipt** button on its page — print it or save it as PDF
- With the **Members** plugin, members signed in when ordering see their history at `/shop/orders`

## For developers

```ts
site.on('eshop.order.created', (o) => log.info('new order', o.id, o.total));
site.on('eshop.order.paid', (o) => http.webhook('https://example.com/hook', 'paid', o));
site.on('eshop.order.status', (o) => log.info(o.id, o.from, '→', o.status));
```

The export `orderTotal([{ id, qty }])` (via `plugins.call('eshop', …)`) returns the total at current prices — the plugin's tables are `p_eshop_orders` and `p_eshop_items`.

> [!NOTE]
> Slips are stored as the plugin's private files (no public link) and only people who can manage orders see them. Slips are not checked with the bank automatically — check the amount in your banking app before pressing **Paid**.
