Prototype an “add” button and cart icon on the same screen

Do you really need to show this in a prototype? Then only through “Navigate to”.

See the design file at the link above, only on Page 2.

And in order for the number on the badge to change, you need to kill time to create each new screen (frame) for the desired combination.

Figma has no logical conditions to do this. You can vote for the addition of this function in this topic: Prototyping | Conditional logic & variables