Using SaleAvailabilityLocations from GetProductInfo

I am trying to use SaleAvailabilityLocations for an asset ID under GetProductInfo from Marketplace Service. Link for reference: MarketplaceService:GetProductInfo

However, this key supposedly is not a number or string but a dictionary type. I am only used to pulling info on asset IDs (specifically from UGC accessories) such as the name or sales numbers since that returns a string/number and I can have that information inserted into a textbox.

Under SaleAvailabilityLocations, the description says “The item’s ProductLocationRestriction or sale location setting (e.g. anywhere, Shop only).” Clicking on “ProductLocationRestriction” brings up this information: ProductLocationRestriction

What I am trying to do is find the value of an asset ID’s “SaleAvailabilityLocation”

But for example, if I try to run

--newAsset is the asset product info from marketplace service
local info = newAsset.SaleAvailabilityLocations
	print(info)

It just returns “nil”

I can’t figure out how to get the value of an asset’s “SaleAvailabilityLocations”. I think I am more confused about using the enums associated with it. I have also tried running something like this

if newAsset.SaleAvailabilityLocations == Enum.ProductLocationRestriction.AvatarShop then
print("ForSaleInCatalogOnly")

but this also doesn’t work.

How can I use enums to figure out the “SaleAvailabilityLocations” of an asset id? I feel like I am over complicating this, I just cant get anything to work.

There is a key that represents a boolean right below that in the documentation. You could check if this boolean is equal to true, then you can sell it in your game, and if it’s false, you cannot.

As for the dictionary the documentation states that all information listed may not be provided based on what you are trying to get (game pass, dev product, asset, etc).

I actually have tried that and it does work for some items. However it seems that older items haven’t been updated with whether or not they can be sold in game, so some items don’t return true/false. I also believe that UGC creations are able to be configured to be for sale in the catalog or any game, so I would think this should work for newer items.

I am only trying this on UGC creations so I would think it has it work on them, at least if they’ve been updated to whether or not they can be sold in the catalog/all games.

The ‘CanBeSoldInThisGame’ field is true for assets that can be sold and false for assets that can’t.

1 Like

That’s interesting. I’m not that familiar with the uploading process regarding UGC items, but my best guess would be that for items that don’t have a SaleLocationAvailability dictionary available are items that haven’t updated those properties.