Supermarket simulator Shelf system (How To)

You need to check if the object you want to put touches anything (except the shelf). To do this, use GetOverlappingActors.
To make the object “stick” to the shelf, use Line Trace from the camera and a little ahead of it to determine the location of the object.

If objects can only be installed on a grid, then you need to find the grid point closest to the Line Trace hit point, install the object in it and perform a check after that.