Death Adder has a good start, but it definitely needs to be MUI for this to even be viable. In my opinion this is best done with a spellbook on each packhorse that allows you to set a target shop, a source building, and turn on/off auto-repeat. You'll need some sort of a
Unit Indexer in your map (there are many varieties, or this whole thing can be done with a hashtable too), two unit arrays to store the current source building and the destination shop, and a boolean array to store whether or not it the pack horse should sell all and repeat. Then 3 abilities: choose source, choose target, stop, and start (stop/start replace each other so you only see 3 at a time) which you can all base on Channel so they have no art/casting time/effects/etc.
Used this as a source:
[Solved] - Order unit to sell item to unit
-
Events
-

Unit - A Unit starts the effect of an ability
-
Conditions
-

(Ability being cast) equal to SET_SOURCE
-
Actions
-

Set PACK_source[(Custom value of (Triggering Unit))] = (Target unit of ability being cast)
-
Events
-

Unit - A Unit starts the effect of an ability
-
Conditions
-

(Ability being cast) equal to SET_TARGET
-
Actions
-

Set PACK_target[(Custom value of (Triggering Unit))] = (Target unit of ability being cast)
-
Events
-

Unit - A Unit starts the effect of an ability
-
Conditions
-

(Ability being cast) equal to STOP
-
Actions
-

Unit - Remove STOP from (triggering unit)
-

Unit - Add START to (triggering unit)
-

Set PACK_active[(Custom value of (Triggering Unit))] = false
-

Unit - Order (triggering unit) to stop
-
Events
-

Unit - A Unit starts the effect of an ability
-
Conditions
-

(Ability being cast) equal to START
-
Actions
-

Unit - Remove START from (triggering unit)
-

Unit - Add STOP to (triggering unit)
-

Set PACK_active[(Custom value of (Triggering Unit))] = true
-

For each (Integer ITEM_LOOP) from 1 to 6 do (Actions)
-


Loop - Actions
-



Set ITEM = (Item carried by (Triggering Unit) in slot ITEM_LOOP)
-



If (All conditions are true) then do (Then actions) else do (Else actions)
-




If - Conditions
-





ITEM not equal to (no item)
-




Then - Actions
-





Custom script: call UnitDropItemTarget(GetTriggerUnit(), udg_ITEM, udg_PACK_target[GetUnitUserData(GetTriggerUnit())]) //change the variable names here to match your variables, but keep the udg_ before each one
-





Skip remaining actions
-




Else - Actions
-
Events
-

Unit - A Unit pawns an item (to shop)
-
Conditions
-

Pack_active[Custom Value of (Triggering Unit)] equal to true //optional line, only enables full inventory sell if active
-

(Unit-type of (Triggering Unit)) equal to Pack Horse //if you don't have the above line use this instead to restrict autosell only to pack horses
-
Actions
-

For each (Integer ITEM_LOOP) from 1 to 6 do (Actions)
-


Loop - Actions
-



Set ITEM = (Item carried by (Triggering Unit) in slot ITEM_LOOP)
-



If (All conditions are true) then do (Then actions) else do (Else actions)
-




If - Conditions
-





ITEM not equal to (no item)
-




Then - Actions
-





Custom script: call UnitDropItemTarget(GetTriggerUnit(), udg_ITEM, udg_PACK_target[GetUnitUserData(GetTriggerUnit())]) //change the variable names here to match your variables, but keep the udg_ before each one
-





Skip remaining Actions
-




Else - Actions
-

-------- If we got all the way here the packhorse inventory is now empty and it can turn around and go back to get more resources --------
-

-------- This is now a problem for the next trigger, so I'll leave this bit blank for now though something WILL go here --------
So the above 5 triggers set the source, target, and 'autosell' variables; and when the unit sells one item it continues to sell everything in its inventory until it's full, then it does <something> to start the process over again. What the <something> is depends really on how you want to get the items from the source building into the pack horse's inventory. Another factor is how the source building stores them anyway-- are they items in its inventory? Are they added to the shop stock via triggers at the right time? Are they units or items that auto-generate more stock every X seconds? This is important because
there is no "order unit to buy item from shop" or "order shop to sell item to unit" action you can use, and that is kinda a roadblock to the simplest solution (effectively what I was able to do with looping the item pawn until no items are left).
I think the best solution would be to make the shops populate their own literal 6-slot inventory and then order them to give it to the packhorses when necessary to transfer. You can still stack items there but only 6 different items could be produced at one time. The next best solution is detecting when pack horses get near a shop they're currently targeting as a source and then filling their inventory with triggers immediately while reducing the source shop's stock. This requires a few triggers with "Unit - A unit comes within <distance> range of <specific unit>" events (which you have to add manually for every source shop on your map) or putting all the packhorses into a unit group and checking if they're near their currently selected source building on a reasonable timeout, like every 1.00 seconds. If you can give more specifics about the way you want to approach this I will be happy to flesh out the trigger more, but for now this is about all I can do.
Finally why not automatically pick the closest shop to sell their items to? Well, you could have a situation where the closest shop (straight line distance) is on a cliff with the ramp very far away, or cut off from the pack horse by a wall of trees, or something else entirely may make it an undesirable location (maybe it's near an un-killed creep camp). IMO it's better to give players control.