1. Do I need the comma after 'opinion' in this statement?
"Of these cars, in our opinion, the best on the market is the Ford."
2. Do I need the comma before 'in our opinion' in this sentence?
"This shampoo is the best in its class, in our opinion."
The phrase 'in our opinion' could be described as a weak interruption. The general rule is that if it (and its commas) can be removed to leave the remaining words making sense, then yes, it should have commas. Commas are used effectively to replace brackets in such cases and may be referred to as 'bracketing commas.'
I persnally think it better to include the phrase immediately after the statement which is a matter of opinion:
"Of these cars, the best on the market, in our opinion, is the Ford."
There are two weak interruptions here which could be omitted to leave "The best on the market is the Ford."
If you were trying to draw greater attention to your opinionated viewpoint, rather than the subject matter, mention your opinion first in the statement:
"In our opinion, the Ford is the best of these cars on the market."
Hope this helps