---
description: You can access the setup information you need about this product
---

# 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](https://github.com/qbcore-framework/qb-core))
* PolyZone ([https://github.com/mkafrin/PolyZone](https://github.com/mkafrin/PolyZone))
* qb-target ([https://github.com/qbcore-framework/qb-target](https://github.com/qbcore-framework/qb-target))
* qb-menu ([https://github.com/qbcore-framework/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;

![](https://344044646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjk6DeXMrr9YWGvceJWb%2Fuploads%2FzD5NUde4kMO01bSrn6Ea%2FScreenshot_3.png?alt=media\&token=650f44c1-99f3-4717-8dbc-6a41e72dec7a)

````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

![](https://344044646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjk6DeXMrr9YWGvceJWb%2Fuploads%2F99aiAtUrYUBfnZPCa7Je%2Fimage.png?alt=media\&token=0f0fa17b-0f3c-4677-a9f0-06db35f7b15b)

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

![](https://344044646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjk6DeXMrr9YWGvceJWb%2Fuploads%2FmO2yyT3Ct8nVXU4VjJ0I%2Fimage.png?alt=media\&token=dd97f5a7-5db4-48a3-b22a-4ebce6d9d12d)![](https://344044646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjk6DeXMrr9YWGvceJWb%2Fuploads%2FJZeNobvI2i58p8L0TITy%2Fimage.png?alt=media\&token=c035b3ea-5591-4a3f-99b6-0af56230d8d8)

3 - Already, okey



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