i have been thinking about this as well.
we developed a nasty habit of going into a dollar store

: -- many things there we get on her request. she usually has good arguments on why she needs this or that, and i think it is important for her to express her needs and for me to respect them. and it IS only a dollar

:
or when we go to a thrift store, i let her choose.
now the problem developed -- we are in another store, she is trying to convince me that she really needs a stroller for her teddy bear, because he likes to watch what is going on, and he can't always see well from the sling, and he is bored there etc -- all logical and pretty valid, only her teddy bear is a TOY :LOL and the stroller is $50. but how to explain to her that her teddy's needs are not the same as her baby brother's needs? to her they are the same, eh?
also, in toy stores *i* can get excited and want something for her. so how do i explain that i am willing to spend $30 on a construction set, but not on a pink horse?
what has been working so far is to discuss what things we are going to buy in the store before we come in. sometimes i tell her that we would only look, won't buy anything. she can carry things and walk with them in the store, but she can't buy them. sometimes i tell her in advance that we will buy only what *i* need.
i also made a distinction between thrift stores and other stores. in other stores we can buy things that we cannot always find in thrift stores -- like lego, construction sets, games. soft toys can be bought only from thrift stores and we try to donate on of ours back if we buy a new one (key word -- 'try' but we are working on it).
if she wants something in a store i tell her how much it costs and that it is too expencive (i know she does not fully grasp is, but i still think it is the best explanation) and that we can try to find something similar in a thrift store or dollar store.
if it is groceries, i might tell her that i don't know how to cook it, and tell her that if she is really interested we can find a recipee and get it next time.
i don't simply say 'no', but i also start an elaborate and truthful explanation with all the reasons, and i offer alternatives.
it works reasonably well. some times she surprises me with 'oh, okay'. sometimes she is resisting, but huge meltdowns have been rare lately.
but i struggle with not being able to fully explain why some things that are important to her are okay to buy, and some are not. i mean i do explain, but it is too abstract -- money, lack of money, too expencive. oh well.