Woocommerce add_to_cart() then wp_safe_redirect() fails

You need to save the cart contents before redirect

WC()->session->save_data();

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