So you wanna learn to trade blocks for XP do you? this is how it's done! :)
COMMANDS USED!
(These go in Repeating Command Blocks)
Block #1
/scoreboard objectives add ITEMS dummy
Block #2
/scoreboard players add @a ITEMS 0
Block #3
/stats entity @a set AffectedItems @a[c=1] ITEMS
Now for the actual Command Shop
command block with this example
/execute @p[r=5] ~ ~ ~ clear @a[c=1] minecraft:cobblestone 0 0
2
command block with this example
/clear @p[r=6,score_ITEMS_min=16] minecraft:cobblestone 0 16
3
command block with this example
/xp 2l @p[r=7,score_ITEMS_min=16]
*DISCLAIMER
This tutorial is pretty intermediate as far as command blocks go!