> For the complete documentation index, see [llms.txt](https://wert-dev.gitbook.io/wert-dev-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wert-dev.gitbook.io/wert-dev-docs/products/qbcore/wert-shops-+-delivery-jobs-buy-and-manage-your-shops.md).

# Wert Shops + Delivery Jobs (Buy and manage your shops)

## <mark style="background-color:blue;">INFORMATION</mark>

* Buy and manage grocery stores. Add new items to your grocery store by ordering goods from the trade center
* Don't forget to put the pictures of the items you will add to the images folder (NOT THE PICTURES WILL NOT APPEAR).

## <mark style="background-color:orange;">INSTALLATION</mark>

1 - Prepare the depends scripts and upload them to the resources folder

* <mark style="background-color:purple;">DEPENDS</mark>
* qb-core (<https://github.com/qbcore-framework/qb-core>)
* PolyZone (<https://github.com/mkafrin/PolyZone>)
* qb-target (<https://github.com/qbcore-framework/qb-target>)
* qb-menu (<https://github.com/qbcore-framework/qb-menu>)
* qb-input ([https://github.com/qbcore-framework/qb-](https://github.com/qbcore-framework/qb-menu)[input](https://github.com/qbcore-framework/qb-input))
* *Note : If u use ox\_lib u dont need qb-input, qb-menu, etc ... U can use lib components.*

2 - Follow the instructions in the important section for qb framework.

## <mark style="background-color:green;">IMPORTANT (ONLY QB FRAMEWORK)</mark>

{% hint style="warning" %}
This install step with old qb-inventory if u use old version follow this step but if u have last updated qb-inventory please check below follow step!
{% endhint %}

> **This is a very important step that allows purchases to connect with wert shops!**

* Open qb-inventory/server/main.lua
  * Add the following codes to the place shown in the picture&#x20;
  * Event name : 'inventory:server:SetInventoryData'
* And add this lines&#x20;

![](/files/wpTmctMqjW5EfWZ8twh7)

````lua
```lua
local shopfound = exports['wert-shops']:ShopCheck(QBCore.Shared.SplitStr(shopType, "_")[2])
if shopfound then
    TriggerEvent("wert-shops:server:UpdateShopItems", QBCore.Shared.SplitStr(shopType, "_")[2], itemData, fromAmount)
    TriggerEvent("wert-shops:server:after-buy", QBCore.Shared.SplitStr(shopType, "_")[2], price)
end
```
````

## <mark style="background-color:green;">IMPORTANT (ONLY NEW UPDATE QB INVENTORY)</mark>

> **This is a very important step that allows purchases to connect with wert shops!**

* Open qb-inventory/server/main.lua
* Find this callback and change with this

```lua
QBCore.Functions.CreateCallback('qb-inventory:server:attemptPurchase', function(source, cb, data)
    local itemInfo = data.item
    local amount = data.amount
    local shop = string.gsub(data.shop, 'shop%-', '')
    local price = itemInfo.price * amount
    local Player = QBCore.Functions.GetPlayer(source)

    if not Player then
        cb(false)
        return
    end

    local shopInfo = RegisteredShops[shop]
    if not shopInfo then
        cb(false)
        return
    end

    local playerPed = GetPlayerPed(source)
    local playerCoords = GetEntityCoords(playerPed)
    if shopInfo.coords then
        local shopCoords = vector3(shopInfo.coords.x, shopInfo.coords.y, shopInfo.coords.z)
        if #(playerCoords - shopCoords) > 10 then
            cb(false)
            return
        end
    end

    if not CanAddItem(source, itemInfo.name, amount) then
        TriggerClientEvent('QBCore:Notify', source, 'Cannot hold item', 'error')
        cb(false)
        return
    end

    if Player.PlayerData.money.cash >= price then
        Player.Functions.RemoveMoney('cash', price, 'shop-purchase')
        AddItem(source, itemInfo.name, amount, nil, itemInfo.info, 'shop-purchase')
        local shop_first = QBCore.Shared.SplitStr(shop, "_")[1]
        if shop_first and shop_first == 'WertShop' then
            local shop_preset = QBCore.Shared.SplitStr(shop, "_")[2]
            local shopfound = exports['wert-shops']:ShopCheck(shop_preset)
            if shopfound then
                TriggerEvent("wert-shops:server:UpdateShopItems", shop_preset, itemInfo, amount)
                TriggerEvent("wert-shops:server:after-buy", shop_preset, price)
            end
        else
            TriggerEvent('qb-shops:server:UpdateShopItems', shop, itemInfo, amount)
        end
        cb(true)
    else
        TriggerClientEvent('QBCore:Notify', source, 'You do not have enough money', 'error')
        cb(false)
    end
end)
```

## <mark style="background-color:orange;">OX LIB OPTION</mark>

1 - Open Config.lua and find this option

![](/files/gdJXYgOkpclkSB3XVGeo)

2 - Open fxmanifest.lua and activate or open this code line (Import Code)

![](/files/HHrTd1R5bNKMYgaXUJin)![](/files/zyet9lzuV77Xlzv03Fhz)

3 - Already, okey

### *<mark style="background-color:green;">Installation complete</mark>*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wert-dev.gitbook.io/wert-dev-docs/products/qbcore/wert-shops-+-delivery-jobs-buy-and-manage-your-shops.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
