By default, there is no option to set different cost price for the variants of the same product in Odoo community edition. What we can do is set same cost price for all variants. But in real cases, it may not be helpful. ‘Product Variant Cost Price’ module bring this feature to community edition
First, install the module and activate the product variants feature from product variants menu, Sales -> Sales -> Product Variants. Now open a product variant form, go to inventory tab. To set cost price, click on the Vendors section, a new field will be available there to set the cost price of the product.