Wal-Mart has been investing heavily to keep its prices competitive and its assortment appealing to shoppers.