If you have large quantities of batch size, look into statistical process control.
If they're smaller batches, the answer seems pretty straightforward (to me, at least):
1. Map out the production process step by step. Operations, inspections, decision points etc.
2. Install a final inspection at the end of the process to accept/reject the product.
3. Look at returns and final inspections to determine the causes of failure. You should see the 80/20 Rule in effect: about 80% of the defects will be from 20% of the sources of problems.
4. Fix those 20% of the sources and clear up most of your issues. Adjust your process flowchart to match the new method. Ensure people are following the new method.
Eventually you should have an inspection done at the end of each step / beginning of the next to ensure the product does not move on unless it is correct.
I'm an operations management guy so feel free to book a call if you wish to dig into specifics.