title: Add a pay order button on WooCommerce My account view order for pending orders
body: <p>How create &quot;pay for this order&quot; button when order status is <code>pending</code> to be displayed on the my account page when viewing an order</p>
  <p>The link structure is as follows:</p>
  <p><code>https://url.com/checkout/order-pay/XXXXX/?pay_for_order=true&amp;key=wc_order_XXXXXXXXXXXX</code></p>
  <pre><code>add_action( 'woocommerce_view_order', 'order_pay_button' );
  function order_pay_button( $order_id ){
  // Get an instance of the `WC_Order` Object
  $order = wc_get_order( $order_id );
  
  // Get the order number
  $order_number  = $order-&gt;get_order_number();
  
      
  // Get the order status name
  $status_name  = wc_get_order_status_name( $order-&gt;get_status() );
  
  // Get the order key
   $test_order_key = $order-&gt;get_order_key();
   
     
  // Display the order status 
  echo '&lt;div&gt;' . __(&quot;Order Status:&quot;) . ' ' . $status_name . '&lt;/div&gt;';
  
  
  
  if ($status_name == &quot;pending&quot;) {
     
       echo '
  &lt;a href=&quot;https://url.com/checkout/order-pay/'.''.$order_number.''.'/?pay_for_order=true&amp;key='.''.$test_order_key.''.'&quot;&gt;
  &lt;button type=&quot;submit&quot; class=&quot;button alt&quot; id=&quot;place_order&quot;&gt;Pay for this order&lt;/button&gt;&lt;/a&gt;';
     
  } 
  
  
  }
  </code></pre>