FRAMEWORKS
Frameworks

How to Add Items to a Shop in ox_inventory data shops.lua

March 25, 2026 · 4 min read

To create an engaging roleplay environment in your FiveM server, it’s crucial to have well-stocked shops that provide players with the items they need. In this guide, we will delve into how to add items to a shop in ox_inventory data shops.lua, a vital skill for any server owner using the ox_inventory framework. This process involves modifying Lua files and understanding the basic structure of item entries.

Understanding ox_inventory and Shop Configuration

The ox_inventory framework offers a flexible and efficient way to manage items in your FiveM server. It operates through a series of Lua scripts that control how items are added, removed, and displayed in shops. The file we'll work with today is located in the data folder of your ox_inventory resource:

/path/to/your/resources/ox_inventory/data/shops.lua

Basic Structure of shops.lua

The shops.lua file is organized into multiple shop entries, each defined by a table. A typical entry looks like this:

['shop_name'] = {
    label = 'Shop Label',
    items = {
        {name = 'item_name', price = item_price, amount = item_amount},
        -- more items
    },
}

Understanding this structure is key to effectively modifying your shops. Each shop has:

  • label: The name displayed to players.
  • items: A list of items available for purchase, where each item includes:
    • name: Identifier of the item.
    • price: Cost in game currency.
    • amount: Quantity available.

Step-by-Step: Adding Items to a Shop

Now, let’s break down the steps to add new items to your shop in ox_inventory data shops.lua.

Step 1: Locate Your Shop

  1. Go to your shops.lua file located in path/to/your/resources/ox_inventory/data/.
  2. Identify the shop you want to edit. Search for the shop label or name defined in your configuration.

Step 2: Item Definition

Before adding an item, ensure it exists in your server’s item database. Navigate to your item definitions file (usually located at /path/to/your/resources/ox_inventory/data/items.lua) and ensure the item you want to add is defined. Here’s how an item definition looks:

['item_name'] = { 
    label = 'Item Label',
    weight = item_weight,
    -- additional parameters
}

Step 3: Add Your Item to the Shop

Once you confirm the item is defined, return to the appropriate shop in shops.lua and add your item entry:

['shop_name'] = {
    label = 'Shop Label',
    items = {
        {name = 'item_name', price = 100, amount = 10},
        {name = 'new_item_name', price = 50, amount = 20}, -- Added this line
    },
}

Ensure you are following the correct syntax. Each item should be separated by a comma, except for the last item in the list.

Step 4: Save and Restart Your Server

Once you have made your changes:

  • Save the modifications to shops.lua.
  • Restart your FiveM server for the changes to take effect.

Step 5: Test Your Changes

After restarting your server, join the game and navigate to the shop you modified. Verify that your new item appears, is correctly priced, and can be purchased without issues.

Troubleshooting Common Issues

If your items do not show up or if there are errors, consider the following troubleshooting tips:

  • Check Item Definition: Ensure that the item you're adding is defined in the items file.
  • Check Syntax: A missing comma or incorrect table structure can cause errors. Double-check your edits.
  • Server Restart: Ensure that you properly restart your server after making changes.
  • Check Console for Errors: Look in your server console for Lua errors to help identify issues.

Additional Tips for Customization

Customizing shop items can enhance your players' experience. Here are some ideas:

  • Dynamic Pricing: Adjust item prices based on supply and demand by modifying the price in the script.
  • Limited Editions: Create special items that are available for a limited time or only during events.
  • Bundle Items: Offer packs or bundles for purchase, enhancing the shopping experience.

Frequently Asked Questions

How do I ensure an item shows up in the shop?

Make sure the item is defined in your items Lua file and that there are no syntax errors in the shops.lua file.

Can I add multiple items at once?

Yes, simply repeat the item entry structure for each new item within the items table.

What if I want to change the price after adding an item?

You can edit the price value in the corresponding item entry in the shops.lua file and restart your server.

Is it possible to import items from other resources?

Yes, you can add items from other resources as long as they are defined correctly in your item definitions file.

Can I use this with other frameworks like ESX or QBCore?

Yes, you can integrate ox_inventory with other frameworks, but ensure you follow their specific item structure and requirements.

By following this guide, you should feel confident in your ability to enhance your FiveM server by customizing shops using ox_inventory data shops.lua. For further enhancements, consider exploring our scripts or MLO maps to make your server even more immersive.

#fivem#ox_inventory#shops#shop_setup#roleplay

Keep reading