Create custom post type on successful woocommerce order [closed]

I managed to figure it out by placing the wp_insert_post function in the same function that saves the order meta data

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)