get woocommerce My account page link

I am trying to send an email to customer after purchased products and when customer click on the the link provided the email for rating the product it should redirect to customer’s account/My account page.
I put some code in functions.php to get the WooCommerce My Account URL:

$myaccount_page = get_option( 'woocommerce_myaccount_page_id' );
if ( $myaccount_page ) {
  $myaccount_page_url = get_permalink( $myaccount_page );
  }

I have customized into customer-completed-order.php and put this code

    <h2> Go to your account page for review </h2>
    <a href="http://animax.cf/product/happy-ninja/#reviews">
        <img src="https://animax.cf/wp-content/uploads/2015/12/product-reviews.png" alt="Product Rating">
    </a>

I want to get woocomerce myaccount url in above code. how should i do this.

5

You can get the WooCommerce my-account URL as below

<a href="https://wordpress.stackexchange.com/questions/213612/<?php echo get_permalink( get_option("woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account',''); ?>"><?php _e('My Account',''); ?></a>

Now you can insert this in completed order mail template too.

<h2> <a href="https://wordpress.stackexchange.com/questions/213612/<?php echo get_permalink( get_option("woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account',''); ?>">Go to your account page for review</a> </h2>
<a href="http://animax.cf/product/happy-ninja/#reviews">
    <img src="https://animax.cf/wp-content/uploads/2015/12/product-reviews.png" alt="Product Rating">
</a>

Leave a Comment