You could use a model-view-controller design, where the items the player has are stored in some internal object (array, children of a node, hash map, etc.) (the model), and then every time a inventory scene is displayed (the view), you dynamically populate the inventory slots to visually represent what's stored in the player's internal inventory data model (the controller).
This way both the shop and inventory don't have to be in sync, since they are only populated when displayed. From the player's perspective they will appear to be in sync. Even if the player's inventory is always visible, the same design can be applied, just update the inventory UI every time the player has his/her inventory data model updated.