I am running an import script which adds a large number of product
post types. Some of these are identical apart from perhaps a size
or colour
value in the CSV.
My script creates the new post types (WP_Product using the WC_Data_Store) and ends up with what I would call duplicates:
post-name
post-name-1
post-name-2
post-name-3
etc
Is there a hook I can run to check if a post name already exists and if so, return it so that I can add the different colour
and size
taxonomy terms instead?
I would ideally need to check the merchant
taxonomy as well as the post name as it's possible there could be 2 different products with the same.