title: Multiple Stripe Accounts Depending on Product / Catagory ID
body: <p>So I've come across this post</p>
  <p><a href="https://www.phpsof.com/how-to-enable-woocommerce-multiple-stripe-acccounts/" rel="nofollow noreferrer">https://www.phpsof.com/how-to-enable-woocommerce-multiple-stripe-acccounts/</a></p>
  <p>which list the following php snippet for the functions.php file</p>
  <pre><code>// -------------------
  // 1. Create function to find Product ID
   
  function phpsof_product_id_in_cart( $id ) {
     $product_cart_id = WC()-&gt;cart-&gt;generate_cart_id( $id );
     $in_cart = WC()-&gt;cart-&gt;find_product_in_cart( $product_cart_id );
     if ( $in_cart ) return true;
     return false;
  }
   
  // -------------------
  // 2. Change Stripe keys on the go
   
  add_filter( 'wc_stripe_params', 'phpsof_conditional_publishable_key', 9999 );
   
  function phpsof_conditional_publishable_key( $params ) {
   
     // PRODUCT ID HERE
     if ( ! phpsof_product_id_in_cart( 12345 ) ) return $params;
   
     // STRIPE Live Publishable Key HERE
     $params[ 'key' ] = 'pk_live_................';
   
     return $params;
  }
   
  add_filter( 'wc_stripe_payment_request_params', 'phpsof_conditional_publishable_key_request', 9999 );
   
  function phpsof_conditional_publishable_key_request( $params ) {
   
     // PRODUCT ID HERE
     if ( ! phpsof_product_id_in_cart( 12345 ) ) return $params;
   
     // STRIPE Live Publishable Key HERE
     $params[ 'stripe' ][ 'key' ] = 'pk_live_................';
   
     return $params;
  }
   
  add_filter( 'woocommerce_stripe_request_headers', 'phpsof_conditional_private_key_headers', 9999 );
   
  function phpsof_conditional_private_key_headers( $headers_args ) {
   
     // PRODUCT ID HERE
     if ( ! phpsof_product_id_in_cart( 12345 ) ) return $headers_args;
   
     // STRIPE Live Secret Key HERE
     $headers_args[ 'Authorization' ] = 'Basic ' . base64_encode( 'sk_live_..........' . ':' );
   
     return $headers_args;
  }
  </code></pre>
  <p>However this doesn't appear to be valid anymore.</p>
  <p>Is there a standard method to replace the stripe payment gateway details for orders containing only certain product ids ? or better, catagory ids ? or shall I limp through with this trying to fix it ?</p>
  <p>Thanks</p>
  <p>Henry</p>