The Law #9635 creates a Capital Gains Tax of 15% which will apply to all investment income and real estate.
For real estate transactions the law provides a one-time exemption for property owners that owned property before the law came into effect on July 1st 2019. For this one-time exemption, the seller will pay 2.25% on the purchase and sale price.
The sale of the primary residence/home is and will remain always exempt from capital gains. For these purposes, according with the law and its regulation, the 'primary residence', is the property whose primary purpose is to serve as the 'shelter, protection and home, and in which the owners reside'.
Therefore, when you sell a commercial or investment real estate, you will have to pay the capital gains and submit the proper tax form to comply with the law.
However, if the property is owned by a foreign and/or person that does not have a domicile in Costa Rica, is not a 'domiciled person', the law requires that the BUYER holdback 2.5% of the purchase and sale price of the property to ensure that any capital gains tax is covered and paid. The law refers to a 'non-domiciled' property owner.
Section number 5 of the Income Tax Law defines who, for tax purposes, will be considered a domiciled person: 'A foreign person will be considered domiciled if spend more than 183 days in Costa Rica.' If the person goes in and out of Costa Rica on sporadic occasions that would not necessarily eliminate the status, but will have to be confirmed by the Tax Office to avoid any issue.
Costa Rican corporations (either a SA or a SRL) duly registered at the National Registry are considered 'domiciled' in Costa Rica as long as their legal domicile (domicilio social) or place of business (domicilio fiscal) is within Costa Rica.