An undated photo from Visit Loudoun shows a Loudoun County winery.

With his nascent China trade war taking shape, President Trump is taking the Republican Party back to its protectionist roots. Virginia may come to regret it.

For his part, Trump doesn’t think we’re entering a war. He says we lost the conflict long ago, owing to “the foolish, or incompetent, people who represented the U.S.” in trade negotiations with the Chinese.

That assertion will come as a shock to Virginia businesses, who are doing quite well in the China trade.

According to the U.S.-China Business Council, China is second to Canada as the commonwealth’s largest foreign market for goods. In 2016, Virginia firms sold $1.4 billion worth of material to Chinese buyers, with the biggest sales coming from pulp and paperboard, meat products and scrap metal.

On the service side, Virginia’s biggest sales to Chinese buyers were travel and education. The Chinese like to visit us and send their kids to school here. It all adds up to economic activity and job creation, things every Virginia governor has chased with great zeal. And few showed as much eagerness to open Chinese markets to Virginia goods as former governor Terry McAuliffe (D).

In 2007, China banned imports of Virginia poultry after testing at a Shenandoah farm came back positive for avian flu. Poultry is big business in Virginia, directly employing more than 17,000 people and generating more than $13 billion in direct and indirect economic activity. Maintaining access to a huge foreign market like China, then, made great economic and political sense.

But nothing happened until 2014, when McAuliffe went to work. As The Post’s Laura Vozzella reported at the time:

U.S. Agriculture Secretary Tom Vilsack, the former Democratic governor of Iowa, met with McAuliffe and Haymore to discuss the ban. So did U.S. Trade Representative Michael Froman. McAuliffe and Haymore also held a conference call with Max Baucus last spring, just as the former Democratic senator from Montana was heading off to China to begin his new job as U.S. ambassador.

Within a month, the ban was lifted, and Virginia was back to selling millions of dollars worth of “chicken feet and wing tips” in the Chinese market.

Or consider the example of McAuliffe’s predecessor, Robert F. McDonnell (R), who made a great show of promoting Virginia wine to a number of potential foreign buyers, including those in China.

In 2013, McDonnell touted a five-year deal between a Chinese importer and a Floyd County vintner, Chateau Morrisette. McDonnell said  it was the kind of deal that “ultimately provide[s] new opportunities, and new jobs, for our agribusinesses and citizens.”

Those opportunities may be harder to come by, as China has imposed a 15 percent tariff on U.S. wines, including sparkling wine, a prime product of aspiring Virginia vintner Eric Trump.

The younger Trump already exports his wines to Canada, Scotland, India and Panama. The Trump winery supposedly has plans to “expand the wines’ distribution nationally and globally.”

Well, maybe not to China.

But other Virginians may not be able to avoid the fallout of a trade war.

The U.S.-China Business council broke down the trade numbers by congressional district to illustrate how much activity, and how many jobs, ere directly tied to Chinese exports.

The districts with the most to lose are the 6th, currently represented by retiring Rep. Bob Goodlatte, and Rep. H. Morgan Griffith’s 9th.

The 6th is home to the aforementioned poultry industry. Roughly $65 million worth of meat products went from the Shenandoah Valley to China in 2016, part of more than $300 million in goods district businesses sold in the Chinese market. The Business Council estimates Chinese trade supported 2,800 district jobs in 2015.

In the 9th district, the top exports were pharmaceuticals, wood products, coal and grains — roughly $249 million in 2016. Those exports supported 2,200 jobs.

Trump won both districts in 2016.

He may cost them dearly if his trade war comes to fruition in 2018.