Congrats on your cosmetic brand, I have a beauty brand too! MBeauty⭐
Tip: coding is always the last resort solution. Most likely Shopify has it by default or a developer made and app for it!
I would suggest a checkout promotions app like CHECKOUT PROMOTIONS (it has this feature: Enable upsell or free gift promotion)
However, FREE is a word customers love. I would try to tell them that they will get a free sample with their order BEFORE reaching checkout. You can do this using a pop up sign, or use an UPSELL promo, so when customers add to cart they would get the option to add the sample. Finally, you can just add "Free samples with every order" in the product page 🙂
Hoped it helped
~ Lanzi ~
Shopify & Klaviyo Partner
PD: If this answer helped you please like & accept it