I assume that at some point in the 2000 year history, there were churches that found it hard to obtain wine at some point. What did the church teach could or should be done in these situations?
You question is based on a few assumptions, let's go over them:
First, a Catholic eucharist can't just use any wine. There are strict rules for its origin and production laid down by the Vatican. Essentially, sacramental wine has to be:
- Made naturally, “from the fruit of the grape, pure and incorrupt”—though raisins are also permissible.
- Not mixed with other substances, though a small quantity of water is mixed in during the ritual
- not turned into vinegar or soured
It is altogether forbidden to use wine of doubtful authenticity or provenance.
Strangely, sacramental wine can actually be red or white, dry or sweet, even fortified, as long as the source of fortification is also grape-derived, and as long as the ABV stays between 5 and 18%.
Once it’s approved by a bishop of the vineyard’s diocese, it can be labelled “sacramental”.
Second, not all Catholic churches, now or in history, serve wine to the laity during (every weekly) Eucharist. The rule governing the minimum frequency of receiving communion nowadays is based on Canon 920, based on the Pio-Benedictine Code (1917 CIC 859), which in turn rested on legislation going back several centuries at least to the Fourth Lateran Council in 1215.
Third, during epidemic periods in history, the consumption of wine (and in some cases also bread) was taken out of the ritual. An example of this is the 1547 Sacrament Act, introduced after the plague, which requires both bread and wine to be given “except necessity otherwise require”. This and similar rules have also recently been invoked by churches as a response to the COVID-19 pandemic.
The inverse (preferential exemption) has also occurred. During prohibition, consumption of Christian sacramental wine was exempted from prohibition laws, while -for example- Jewish kiddush was not.
Lastly, the relevance of consumption from the perspective of the laity has also declined in the last century or so. According to a recent Pew Research survey, the majority (69%) of Catholics in the US believe that the bread and wine of the Eucharist are merely symbolic and not transubstantiated, the very belief which makes the consumption essential to the ritual. Maintained belief in transubstantiation is highest in the oldest living generations (38% compared to the average 29%).
Historically, what would happen if a church could not afford or provide wine for the sake of the Eucharist?
Theologically speaking no mass could be said during the time that neither the bread or the wine was unavailable. Personally, I doubt this has occurred for the reasons you stated.
However it has happened occasionally due to persecution, in which case the priest and/or faithful have made a spiritual communion.
Before going on let us take a quick look at the the subject of the Catholic Mass.
The bread and wine are of such importance to the celebration of the mass that priests would always take the upmost care to maintain that they had both these elements to be able to say mass. At least flour to make hosts and raisins to make wine in an emergency. I personally know of priests who make their own hosts and wine for Mass. This is that important in the minds of many priests.
Besides this, historically, the only person to receive Holy Communion at Mass would be the celebrating priest. Most of the faithful would make a spiritual communion on Sundays. This all changed under Pope Pius X.
Another point to be made is that priests must celebrate Mass on Sundays and on Holy Days of Obligation. Most do so on weekdays, but is not mandatory.
For most of the second millennium, before the twentieth century brought changes beginning with Pope Pius X's encouragement of frequent Communion, the usual Mass was said exactly the same way whether people other than a server were present or not. No homily was given, and most often only the priest himself received Communion. Moral theologians gave their opinions on how much time the priest should dedicate to celebrating a Mass, a matter on which canon law and the Roman Missal were silent. - Mass in the Catholic Church
Thus we can see that times have changed and the need for large quantities of bread or wine were generally non-existent. The real reason for a lack of bread and/or wine to celebrate the Holy Sacrifice of the Mass would generally come about from persecutions and not poverty. In such cases many priests and faithful would have to have recourse to the devotion of a spiritual communion.
Spiritual Communion is a Christian practice of desiring union with Jesus Christ in the Holy Eucharist. It is used as a preparation for Holy Mass and by individuals who cannot receive Holy Communion.
The practice of Spiritual Communion has been especially used by Christians in times of persecution, such as during the era of state atheism in the Eastern Bloc, as well as in times of plagues, such as during the current COVID-19 pandemic, when many Christians are unable to attend Mass, and therefore not able to receive the Eucharist on the Lord's Day.
St. Thomas Aquinas defined Spiritual Communion as "an ardent desire to receive Jesus in the Holy Sacrament and a loving embrace as though we had already received Him."
The basis of this practice was explained by Pope John Paul II in his encyclical, Ecclesia de Eucharistia:
In the Eucharist, "unlike any other sacrament, the mystery [of communion] is so perfect that it brings us to the heights of every good thing: Here is the ultimate goal of every human desire, because here we attain God and God joins himself to us in the most perfect union." Precisely for this reason it is good to cultivate in our hearts a constant desire for the sacrament of the Eucharist. This was the origin of the practice of "spiritual communion," which has happily been established in the Church for centuries and recommended by saints who were masters of the spiritual life. St. Teresa of Jesus wrote: "When you do not receive communion and you do not attend Mass, you can make a spiritual communion, which is a most beneficial practice; by it the love of God will be greatly impressed on you" [The Way of Perfection, Ch. 35.].1.
The practice of Spiritual Communion is used by Christians, especially Lutherans, Catholics, Anglicans and Methodists, when they have been unable to receive the Holy Communion, especially in times of sickness and during persecution by states hostile towards religion. Anglican priest Jonathan Warren Pagán cited the joy Walter Ciszek experienced by making spiritual communion during the era of state atheism in the Soviet Union that resulted in the persecution of Christians in the Eastern Bloc.
In any case, when a priest is unable to celebrate Mass (with or without) the faithful present, for whatever reason and no reserved hosts are on hand, the only remaining option is to make a spiritual communion!
It turns out that Canon 927 says "It is absolutely forbidden, even in extreme urgent necessity, to consecrate one matter without the other or even both outside the eucharistic celebration".