For wandering trader: Example you wanted 2 add trade, 6 emeralds for 2 golden apple.
/data merge <trader> {Offers:{Recipes:[{buy:{id:”emerald”,Count:6b},sell:{id:”golden_apple”,Count:2b},maxUses:<a number>}]}}
say u wanted 2 add another 1
/data modify <trader> Offers.Recipes append value{buy:{id:”golden_carrot”,Count:2b},sell:{id:”emerald”,Count:3b},maxUses:<a number>}
obviously change the trades if u want to
I’ve done this with traders, not sure if it’s the same with villagers.
MAKE SURE TO REMEMBER HOW MANY BRACKETS!
hope it helps :)