Online shopping optimization in this context means, in general, making the optimal business decisions with regard to an online or electronic commerce purchase. The method begins with extracting buyer's demand information from buyer-specified items or a previously-configured shopping cart. It then includes a product catalog search that, when provided with the items specified or selected by the buyer, returns exact or equivalent (i.e., replacement or substitute) items. With the catalog search results, the online shopping optimization method formulates the online shopping decision-making problem into a mathematical programming model, particularly a mixed integer programming model. The method optimally decides, from the universe of vendors and items within the system: 1) from which of the various vendors to buy, 2) what identical, replacement, or substitute items to buy, 3) what package sizes of these items to buy, and 4) how many of each item to buy. To summarize, the system systematically and quantitatively makes decisions for a buyer over various cataloged items in order to maximize or minimize an objective function subject to various constraints including the buyer's demands of the desired items, the minimum order requirements imposed by the vendors on the buyer's spent monetary amount, together with other types of buyer, vendor, buyer-and-vendors interrelationship, or among-vendors interrelationship constraints. Recommended optimized shopping carts are then presented to the buyer.