Why are custom fields shown as null?

I create a custom field set and assign it to a product. Then I write values in that fields from product settings. Then I dump the page.product variable and see that customfields show a null. Is this a bug?

I have found an answer to this question, It seems that if the product contains variants, then the values from the custom fields are not linked by default to the variants and the fields are left empty. You have to manally fill the custom fields in each variant.

If there is another workaround then please let me know.