Some of William Shakespeare's most famous plays were located outside of England proper. "The Merchant of Venice", "Romeo and Juliette", as well as "Julius Caesar", were plays set in the historical landscape of Italy. However, did Shakespeare ever travel to Italy as an inspiration for writing his famous plays?-(just as Ernest Hemingway traveled to Pamplona, Spain as an inspiration to write his famous novel, "The Sun Also Rises").
It appears from biographies such as this one that the answer is no. Few people (other than military or diplomatic) traveled abroad in the 16th century, and Shakespeare did not fit the "adventurer" mold. Certainly there is little evidence of either "adventure" or "travel" in his writings, other than some "exotic" locations and place names. In fact, Shakespeare was the diametric opposite of the above type of person; a bookish, landowning, married family man with heavy domestic responsibilities. (The two were basically mutually exclusive because either "domestic responsibilities" or "travel demands" (think Magellan or Drake) were far heavier in Shakespeare's time than in ours.)
The use of "Italian" (and other foreign) cities appears to have been a literary device. That is, they were used to refer to some random or mythical place halfway around the world (Italy was that in relation to England in the 16th century; even 20th century Neville Chamberlain referred to Czechoslovakia as "a faraway place of which we know nothing.") And the Mediterranean then carried connotations of mystery that we might attached to the "South Pacific" today. These places, however, had names that were not totally unfamiliar to the English-speaking public.
Put another way, Shakespeare's stories were mostly generic stories in search of places (although it is noteworthy that "Merchants of Venice was set in the city that invented the "ghetto.") Basically, Italy was a political (and literary) "punching bag," in Shakespeare's time because it was a collection of city-states that was not part of a unified country. Shakespeare did have a strong acting background, and that fact alone may have enabled him to create the verisimilitude of having traveled without actually doing so.
Shakespeare's situation was different from Hemingway's "The Sun Also Rises." There, the Pamplona location was central, not incidental, to the story. It was written for and about Pamplona itself, not some random location to which the name "Pamplona" was attached. Unlike Shakespeare, Hemingway was a (World) war veteran who was well traveled even compared to his peers.