title: Change Woocommerce checkout to process order on an separate WordPress site?
body: <p>I need to create how Woocommerce handles orders so I can create an order on <code>Site A</code> and send that order to <code>Site B</code>.</p>
  
  <p>So when customer adds items to their cart and click checkout, it creates the order on both <code>Site A</code> and <code>Site B</code>, however, it also redirects the user to <code>Site B</code> to process the payment. </p>
  
  <p>So far I can only change the checkout button:</p>
  
  <pre><code>add_filter( 'woocommerce_get_checkout_url', 'my_change_checkout_url', 30 );
  
  function my_change_checkout_url( $url ) {
     $url = "your checkout url ";
     return $url;
  }
  </code></pre>
  
  <p>and creating the order.</p>
  
  <pre><code>if (isset($_POST['isOrder']) &amp;&amp; $_POST['isOrder'] == 1) {
      $address = array(
          'first_name' =&gt; $_POST['notes']['domain'],
          'last_name'  =&gt; '',
          'company'    =&gt; $_POST['customer']['company'],
          'email'      =&gt; $_POST['customer']['email'],
          'phone'      =&gt; $_POST['customer']['phone'],
          'address_1'  =&gt; $_POST['customer']['address'],
          'address_2'  =&gt; '', 
          'city'       =&gt; $_POST['customer']['city'],
          'state'      =&gt; '',
          'postcode'   =&gt; $_POST['customer']['postalcode'],
          'country'    =&gt; 'NL'
      );
  
      $order = wc_create_order();
      foreach ($_POST['product_order'] as $productId =&gt; $productOrdered) :
          $order-&gt;add_product( get_product( $productId ), 1 );
      endforeach;
  
      $order-&gt;set_address( $address, 'billing' );
      $order-&gt;set_address( $address, 'shipping' );
  
      $order-&gt;calculate_totals();
  
      update_post_meta( $order-&gt;id, '_payment_method', 'ideal' );
      update_post_meta( $order-&gt;id, '_payment_method_title', 'iDeal' );
  
      // Store Order ID in session so it can be re-used after payment failure
      WC()-&gt;session-&gt;order_awaiting_payment = $order-&gt;id;
  
      // Process Payment
      $available_gateways = WC()-&gt;payment_gateways-&gt;get_available_payment_gateways();
      $result = $available_gateways[ 'ideal' ]-&gt;process_payment( $order-&gt;id );
  
      // Redirect to success/confirmation/payment page
      if ( $result['result'] == 'success' ) {
  
          $result = apply_filters( 'woocommerce_payment_successful_result', $result, $order-&gt;id );
  
          wp_redirect( $result['redirect'] );
          exit;
      }
  }
  </code></pre>
  
  <p>Though I'm not sure how to put all of this together so I can work with both Site A and Site B.</p>
  
  <p>How can I do this?</p>
  
  <p>EDIT: To explain more what I need this to do, I need to process payments on a second website, where it also has the products. </p>
  
  <p>So, Customer buys product on Site A, after clicking "Pay with Paypal" (Instant Checkout) and "proceed with payment", the customer and it's information it filled is taken to Site B, where their either able to finalize the payment, OR be directly taken to the Paypal gateway on Site B.</p>