Display addresses on the order pay page in WooCommerce

Display addresses on the order pay page in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_action( 'before_woocommerce_pay', 'wc_order_pay_billing_address' );
 
function wc_order_pay_billing_address() {
 
   // ONLY RUN IF PENDING ORDER EXISTS
   if ( isset( $_GET['pay_for_order'], $_GET['key'] ) ) {
 
      // GET ORDER ID FROM URL BASENAME
      $order_id = intval( basename( strtok( $_SERVER["REQUEST_URI"], '?' ) ) );
      $order = wc_get_order( $order_id );
 
      // INCLUDE CUSTOMER ADDRESS TEMPLATE
      wc_get_template( 'order/order-details-customer.php', array( 'order' => $order ) );
 
   }
}
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.