# Configuring shops in ox_inventory

> Complete ox_inventory shops reference: data/shops.lua fields, item price, count, licence and grade options, RegisterShop at runtime and a buyItem hook.

Source: https://fam-tools.com/guides/ox-inventory-shops-config · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 10 min

**Short answer.** A shop in `data/shops.lua` has a `name`, optional `blip`, an `inventory` list and either `locations` (with markers) or `targets` (for ox_target). Items take `name` and `price`, plus optional `count` (stock), `currency` (for example `black_money`), `license`, `grade` and `metadata`. Restrict a whole shop with `groups`. From your own resource use `exports.ox_inventory:RegisterShop(type, details)` and open it with `openInventory('shop', { type = type, id = 1 })`.

## Key points

- One table per shop type; `locations` or `targets` for where.
- Item options: `price`, `count`, `currency`, `license`, `grade`, `metadata`.
- `groups` limits the whole shop to jobs.
- `RegisterShop` for runtime or player-owned shops.
- Log purchases with a `buyItem` hook.

Every general store, pharmacy, hardware shop and armoury in an ox_inventory server is a shop definition. The same small set of fields covers them all — plus an export for shops your own resources create, like player-owned businesses.

## A shop definition

*ox_inventory/data/shops.lua*

```lua
Hardware = {
    name = 'Hardware Store',
    blip = { id = 402, colour = 69, scale = 0.8 },
    inventory = {
        { name = 'lockpick', price = 250 },
        { name = 'repairkit', price = 600, count = 20 },
        { name = 'WEAPON_HAMMER', price = 150 },
    },
    locations = {
        vec3(2748.0, 3473.0, 55.67),
    },
    targets = {
        { loc = vec3(2747.8, 3472.9, 55.67), length = 1.0, width = 3.0, heading = 65.0, minZ = 55.0, maxZ = 56.8, distance = 3.0 },
    },
},
```

## Item fields

| Field | Meaning |
| --- | --- |
| `name` | Item name from items.lua or weapons.lua |
| `price` | Cost per item |
| `count` | Limited stock (omit for unlimited) |
| `currency` | Item used to pay, for example `black_money` |
| `license` | Licence required to buy |
| `grade` | Minimum job grade (with shop `groups`) |
| `metadata` | Metadata given with the item, for example `{ registered = true }` |

Weapon-specific setups (legal store, police armoury, black market) are in [weapon shop setup](https://fam-tools.com/guides/fivem-weapon-shop-setup).

## Shops at runtime

*server.lua — a player-owned café*

```lua
exports.ox_inventory:RegisterShop('BeanMachine', {
    name = 'Bean Machine',
    inventory = {
        { name = 'coffee', price = 12 },
        { name = 'donut', price = 8 },
    },
    locations = { vec3(-634.3, 235.2, 81.9) },
    groups = nil,
})
```

*client.lua — open from a script*

```lua
exports.ox_inventory:openInventory('shop', { type = 'BeanMachine', id = 1 })
```

`id` is the index of the location in the shop’s `locations`/`targets` list.

## Logging and controlling purchases

*server.lua*

```lua
exports.ox_inventory:registerHook('buyItem', function(payload)
    print(('%s bought %sx %s for %s'):format(payload.source, payload.count, payload.itemName, payload.totalPrice))
end, { typeFilter = { Hardware = true } })
```

Return `false` from the hook to cancel a purchase. More: [ox_inventory hooks](https://fam-tools.com/guides/ox-inventory-hooks).

## Questions

### How do I add a shop to ox_inventory?

Add an entry to `data/shops.lua` with a name, inventory and locations or targets, or call `exports.ox_inventory:RegisterShop` from your resource.

### How do I make a shop accept dirty money?

Set `currency = 'black_money'` on the items.

### How do I limit stock?

Give the item a `count`.

### How do I open a shop from a script?

`exports.ox_inventory:openInventory('shop', { type = 'ShopType', id = 1 })` on the client.

## Related

- https://fam-tools.com/guides/fivem-weapon-shop-setup
- https://fam-tools.com/guides/ox-inventory-hooks
- https://fam-tools.com/guides/ox-inventory-items-lua
- https://fam-tools.com/guides/fivem-weapon-license-system
