My short answer? Punctuate your sentence in one of the following two ways:
"The contents of your bag will include cheese, crackers and, optionally, vegetable stock."
"The contents of your bag will include cheese, crackers and (optionally) vegetable stock."
THE LONG & BORING ANSWER
To be really boring, your question raises two technical issues:
- the comma after "crackers" - which is an example of the "Oxford comma" rather than the "serial comma"; and
- how to treat the "optionally".
Let's go through these one by one.
THE OXFORD COMMA
A comma prior to the "and" in a list of items is known as an Oxford comma. It is defined as:
"a comma used after the penultimate item in a list of three or more
items, before ‘and’ or ‘or’ (e.g. an Italian painter, sculptor, and
The appropriateness of an Oxford comma is a the subject of considerable debate.
Some people love Oxford commas; some people hate them. (I'm the latter camp, by the way - I detest them! - perhaps because of my British education.)
If you look through a set of published books and journals you will notice that majority of publications and authors do NOT use the Oxford comma. For instance, the highly regarded economics journal, The Economist, publishes a guide called The Economist Style Guide, which is very widely used in the business world internationally. A copy of the style guide is freely available at https://bordeure.files.wordpress.com/2008/11/the-economist-style-guide.pdf.
On page 145 of the Guide (yep, it's really long!), you will see:
"The use of a comma before the final and in a list is called the serial or Oxford comma: eggs, bacon, potatoes, and cheese.
Most American writers and publishers use the serial comma; most British writers and publishers use the serial comma only when necessary to avoid ambiguity: eggs, bacon, potatoes and cheese but The musicals were by Rodgers and Hammerstein, Sondheim, and Lerner and Lowe.
Your sentence currently uses the Oxford comma.
COMMAS VS BRACKETS: THE WORD "OPTIONAL" IN YOUR SENTENCE
Currently you punctuate your sentence only with commas. While that is fine, there are advantages to using other punctuation marks - for instance, parentheses (commonly called "brackets" in some countries). The advantage of having two types of punctuation marks is the parsing is a lot easier for the reader.
If I were writing your sentence, I would:
The sentence would then be written in either of the following two ways.
"The contents of your bag will include cheese, crackers and,
optionally, vegetable stock."
"The contents of your bag will include cheese, crackers and
(optionally) vegetable stock."