/gamerule doLimitedCrafting true
Activates the gamerule
/give @p minecraft:knowledge_book 1 0 {Recipes:["minecraft:jungle_planks","minecraft:stick"]}
Gives to a player a knowledge book with a list of recipes (just add a ,"minecraft:your recipe" to add a recipe)
/clear @a stick 0 0
Verifies if a player has an item (change "stick" to change the item)
/recipe give @a minecraft:wooden_button
If the player has the item (Stick) from the previous command, this command is triggered and gives you the recipe for wooden buttons (Change "minecraft:wooden_button" with the id of your block [f3+h to see ids])
/advancement test @a minecraft:story/enter_the_nether
Detects if you went to the nether (change "story/enter_the_nether" to change the advancement you are testing)
/recipe give @a minecraft:diamond_sword
If you revoked the advancement, you'll active this command, that gives you the recipe for the diamond sword
fd