I overcame this when I realized I spent too much on useless things. So what I do now is I ask myself first when and where I'm going to use the item and if I really need it. If I can't convince myself with my answer, I won't buy it. I usually make lists of things to buy, and that's where I base my spendings to make sure I don't go out of hand and buy stuff that do not have much use.
Ever since I got the courage to buy online and was totally happy with the result, I started spending hours just scrolling through online shops for things I'd want to buy. I'd add them all in my wishlists and shopping carts not even caring about the price. I didn't buy any of them, though. I realized what I was doing was so stupid because I didn't even realize that I didn't have enough money to buy even one of the items I wanted to buy (because I'm still a student so I don't have much money). I was so amazed by online shopping that I was close to dangerously buying everything I liked. I had to tell myself that I should only buy what I really NEEDED and disregard everything that I just WANTED. I list down the pros and cons if ever I buy a product and if I see that it would benefit me, I'd save up for it and buy it. If it's just something I want and would probably not use it after a few months, then I better forget it. If I keep on looking at it (and even dream about it) for months, I consider buying it as well.
When shopping, especially online, I just try to be as organized as possible. I keep my purpose in mind for shopping and I force myself to stay focus on what I actually arrived to the store to get. I also have a strict budget if I plan to get alot of things around the same time period that way if I decide to get something that I did not originally plan for, the entire plan will get ruined so I basically have to stay within the budget.
Honestly I dont even really have the urge to impulse buy anymore. I've disciplined myself to be very frugal. Especially as I've grown older. I think its just a part of growing up. As you make more money and are responsible for buying everything yourself you are a lot less wasteful with your money.
I also find myself quite opressed by these momentary decisions of buying a product not because it would be productive and actually help me, but because, for the moment, my emotion tells me that respective fancy and expensive item would fit my desk very well, whereas my reason would tell me the exact opposite... and you know which of these two usually wins.
Whenever I get money, I make it a habit to stash some in a savings account. Then, to avoid wasting my spending money on impulse decisions, I set a goal for what I want with my spending money like a new laptop. Any impulse buys make me feel regretful since I hindered my progress to my goal. When I finally reach my goal, I wait until I'm about $50-$100 above my goal, then buy the item. That way, I have stuff in my savings account and some extra money in case I need it.