Custom PHP Location

I have some custom PHP that will add a menu to the top of my WooCommerce page. Where can I put this code where it will not be overwritten if there is an update to the Rocked Pro theme?

Hello, I have already answered in this topic:

Kind Regards, Roman.