The Shulhan Aruch (307:4) rules that one may give money to a non-Jew before Shabbat to buy things on one’s behalf so long as he does not tell the non-Jew to buy in on Shabbat. If the non-Jew decides to buy it on Shabbat of his own accord, the Jew may benefit from this purchase. This is in line with the Talmudic dictum of “Ada’ata Denafshe Ka’avid” (lit. “of one’s own accord”) which means that the non-Jew performed the forbidden act on Shabbat because it was more convenient or any voluntary reason, then a Jew may benefit from such an act.
Rabbi Yitzhak Benoualid (Vayomer Yitzhak, Orah Haim, § 24) discusses a case in which one asks a non-Jew to sell one’s merchandise on one’s behalf and will be paid a commission. Since the non-Jew will be selling for his own gain and was not told to do it specifically on Shabbat, then the Jew may benefit from the proceeds of the sale. If it is known that the salesperson is working for a Jew, he writes, then it is considered more problematic Halachically. Thus, one may have one’s non-Jewish salespeople sell merchandise on Shabbat as long as they were not told beforehand to do it on that day. However, if it is clear that the salespeople are working on behalf of the Jew and it is known that the owner of the company is Jewish, then it would not be permitted.
In the past, there were only certain days that markets were open. The Mishna Berura (M.B. O.H. ibid:15) discusses a locale in which their market day was Shabbat. In such a case, he writes that it would be forbidden to tell a non-Jewish worker to go to market on the market day since the implication is to go on Shabbat. Rabbi Yehuda Ayash (Bet Yehuda, O.H. § 44), citing the Bet Yosef, disagrees and says that unless one explicitly tells the worker to buy it on Shabbat, then it would not be a problem.
One relevant application of this Halacha is choosing a delivery date when shopping online. Clicking a Saturday delivery date option is akin to telling a non-Jew to do a prohibited act on Shabbat on one’s behalf and as such should be avoided. Nevertheless, clicking for delivery is not exactly like directly telling a non-Jew to deliver the product because the order triggers a series of actions that lead to one finally receiving a product at home. As such, in a situation such as if someone needs medication specifically on Saturday, there are leniencies on which one can rely.
Summary: One may not ask a non-Jew to buy merchandise on one’s behalf on Shabbat unless the non-Jew has some interest in this transaction. One should avoid choosing a delivery date which falls on Shabbat when shopping online.