Display related products with custom output

WooCommerce has a built in function that will do this for you called wc_get_related_products().

That will return an array of product IDs which you can then use in a proper custom loop. I recommend you avoid using WP_Query() and get_posts(). See here for an article I wrote on the right way to create a custom WooCommerce loop: https://cfxdesign.com/create-a-custom-woocommerce-product-loop-the-right-way/

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