Calculate Shortest Path (Shortest Time) Through a Store in a Graph
You can do this with two instances of shortest paths.


You need to know the shortest distance $d(A,S)$ for each store $S$. This is just Dijkstra from source $A$.
You also need to know all the shortest paths from each store to B; i.e. $d(S,B)$ for each store $S$. This can be done by reversing the edges in the graph and running Dijkstra from source $B$.


Once you have these two, all you need to do is compute the min over paths that stop at a store, including the weight $w$ of the store.

$\min_S \left(d(A,S) + w(S) + d(S,B)\right)$

Asymptotically, in total, this is no more expensive than just running Dijkstra's algorithm. In practice you can stop early in each instance of Dijkstra once you've seen all of the stores.