onProductRemoved

Purpose

Triggered when a product is removed from a shop. Use this hook to track catalog changes and log product removals.

When It Triggers

  • Owner or authorized employee removes a product

  • Product is removed from the shop's catalog

Parameters

Parameter
Type
Description

data.source

number

Server ID of actor

data.shopId

string

Unique shop identifier

data.shopName

string

Display name of the shop

data.actorIdentifier

string

Identifier of person who removed

data.actorName

string

Name of person who removed

data.productId

string

Item spawn name

data.productName

string

Product display name

data.timestamp

number

Server timestamp

Example

exports['sd-shops']:registerServerHook('onProductRemoved', function(data)
    -- Log product removal
    print(('[PRODUCT] %s removed "%s" from %s'):format(
        data.actorName, data.productName, data.shopName
    ))

    -- Send Discord notification
    exports['your-logging']:Log('product-removed', {
        shop = data.shopName,
        product = data.productName,
        productId = data.productId,
        removedBy = data.actorName
    })
end)

Last updated