Hi @HelenaB, Please go to this link and check Step no. 4
Nick here from Shopify. Great question!
I spoke to the Shopify theme support team directly about this for you. They mentioned that the Afterpay code is manually added to a theme so you would likely need to re-add the code to the new theme and any other theme you would make your primary theme going forward. Do you remember how you added the code for Afterpay the first time?
@m_waqas link might be the solution you are looking for also.
All the best, Nick