Adding product on checkout page

Hi everyone,

I’m trying to add a product dynamically on the Checkout page and running into some issues.

Here’s my use case:
I want to include a “Gift Wrap” checkbox on the Checkout page. When a user selects it, the order should be marked as a gift, and an extra product (for gift wrapping and an additional fee) should automatically be added to the checkout.

I’ve already created a separate product with a fixed amount for this fee, but I haven’t been able to successfully add it to the checkout. I’ve tried several approaches mentioned in the docs and suggestions from the AI assistant, but none have worked so far.

Has anyone managed to achieve something like this, adding a product or fee dynamically during Checkout (perhaps using Checkout UI extensions) I am creating this as public app?
Any examples, guidance, or best practices would be greatly appreciated!

Perhaps share what you’ve tried and people may be able to help debug where you’ve gone wrong.