I'm writing this answer to clearly state the usage of a sign for this process. Signs in Minecraft have a JSON tag specifically for running commands called "clickEvents". I made a system using this idea with a focus on reducing the amount of commands active at once.
Assumptions
With this process, I assume:
- you wish to only allow the player to buy items while in the shop
- you wish to permit players to buy items if and only if they have enough money for it
- the Buy trigger made in this process is already enabled
- there already exists a dummy objective for money
- your current Minecraft version is 1.9
Reference Image (mostly for later)

Setup
Before we can begin making our signs, we need to do a few things.
Objectives
Firstly, let's make our test to make certain that the player is in the shop.
/scoreboard objectives add inShop dummy
Next, we need to make the trigger that will allow the player to show that they wish to buy something.
/scoreboard objectives add Buy trigger
We'll set the buy trigger differently according to the item we wish to buy, that way, we have less conditionals to follow. You need to enable this trigger for all players every time a player enters the store.
I'll leave it to you to decide how the player is shown to be in the shop, but if they are in the shop, you should set inShop
to a value above 0
, and then back to 0
when they leave. If you want me to add a method that I would personally suggest for doing this, please leave a comment and I will do so.
Now that we've set up our objectives, it's time to move onto command blocks that will permit us to see whether or not our player is buying an item. Set up a repeating command block with the following command:
/scoreboard players test @a[score_inStore_min=1] Buy 1 16
Replace 16 with however many different buy options you have. This block returns whether or not players inside the shop are currently buying anything, and is seen as the leftmost block in System 1. We still want to keep inShop
as a test case to prevent players outside of the shop from buying items.
Now we need to set up the blocks that will actually trigger when affected. The next block in the sequence should be an always active conditional chain command block with the following command:
/execute @p[score_Buy_min=1,score_Buy=1] ~ ~ ~ setblock <x> <y> <z> redstone_block
Replace with coords directly beneath the bottom command block of System 2. You cannot use ~ ~1 ~
, as this will be in reference to the player.
The bottom command block, an impulse block, should be activated by the previous command's redstone setblock, and should reset that block to air using the following command:
/setblock ~ ~-1 ~ air
In the next couple of command blocks, you should change <desired cost>
to the desired cost, and similarly with <desired item>
The always active chain command block above it should contain the following command:
/give @a[score_Buy_min=1,score_Buy=1,score_inStore_min=1,score_money_min=<desired cost>] <desired item>
Then, the next up:
/scoreboard players remove @a[score_Buy_min=1,score_Buy=1,score_inStore_min=1,score_money_min=<desired cost>] money <desired cost>
The final block up:
/scoreboard players set @a[score_Buy_min=1,score_Buy=1,score_inStore_min=1] Buy 0
Cleanup
The rightmost command block of System 1 should contain the following command:
/scoreboard players enable @a Buy
How to extend with this process
We used score_Buy_min=1,score_Buy=1
for our selector conditionals previously; to continue, simply add another chain command block (unconditional this time) before the final command block in System 1 with the following contents:
/execute @p[score_Buy_min=<number>,score_Buy=<number>] ~ ~ ~ setblock <x> <y> <z> redstone_block
Simply replace <number>
with the next Buy value, and repeat the steps for System 2 directly above this block in the same fashion.
We now have an extendable system for trade! Now onto the signage.
Using sign clickEvents
If you don't already have a sign generator, you can use this one. Change the Command Type box to "Set Block" and fill in the text information as you see fit. For our purposes, I have posted a simple possible result based on the information specified in the question using the Buy value of 1.
/give @p sign 1 0 {BlockEntityTag:{Text1:"{\"text\":\"Wooden Pickaxe\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"trigger Buy set 1\"}}"}}
This is a sign that looks like this:

And, when run, will act as though the player has executed the following from the command line:
/trigger Buy set 1
You now have a clickable buying mechanism.
If you need any clarifications, let me know, and I'll do my best to answer them.