If you're importing an A.I. then use the A.I. API that gives a little more flexibility on the matter. If you however, doing what I imagine and have some custom hero that you want to buy and use, then you need something else.
Whatever the issue, you can likely fix it by putting event checks to determine when an A.I. is doing something near a shop or close to a shop and you want to override existing orders and have him go buy and use something appropriate. Or you could check the resource amount of the owning player. Or you could just do it intervals and have the A.I. go to the shop every so seconds.
Point being, you need to generate a detection in order to proc actions. The actions of course being "Move-to", "Purchase", "Use", "Continue-with-previous-action-queue".