Dear student
Acetic acid is the chemical compound which is used in preparation of soaps, as well as preservation of pickles.
Acetic acid and sodium hydroxide (NaOH) react to make sodium acetate. Sodium acetate adds hardness to soap.
CH3COOH + NaOH --> CH3COONa + H2O
Acetic acid used to stop bacterial growth in pickles. Hence it is added to pickles.
Regards