I am creating a custom import script (say from a CRM system) and I need to create products and product variations.
I have been unable to find any recent snippets about how to do this in the most recent version of WooCommerce. I am able to find some outdated approaches, but these do no longer work.
Could somebody provide and example code of how to programmatically create a product variation and attach attributes to this?