Disable Woocommerce Stripe Gateway / WCMP Stripe Gateway

WCMp Stripe Marketplace

Disable Woocommerce Stripe Gateway / WCMP Stripe Gateway Open

Viewing 1 reply thread
  • Author
    Posts
    • #95949
      Alexandra ZWANG
      Participant

      I have two categories of products on the site: products that have no assigned seller for which I only want the display of the woocommerce stripe gateway
      and products with an assigned seller for which I only want the display of WCMP Stripe Mareplace Gateway.

      Currently WCMP is displayed on products that do not have a seller. I do not want to hide woocommerce sripe on these products because they are not subscriptions but products related to paid memberships

      Thanks for your help

    • #96036
      sumit singh
      Moderator

      Hi, Add the following code in functions.php of your current theme

      add_filter( 'woocommerce_available_payment_gateways', 'unset_gateway_by_seller_product' );
      
      function unset_gateway_by_seller_product( $available_gateways ) {
          
          $vendor_product = 0;
          foreach ( WC()->cart->get_cart_contents() as $key => $values ) {
              if(get_wcmp_product_vendors($values['product_id']))
                  $vendor_product++;
          }
          if($vendor_product) {
              unset( $available_gateways['stripe'] );
          } else {
              unset( $available_gateways['wcmp-stripe-marketplace'] );
          }
          return $available_gateways;
      }
      Copy
Viewing 1 reply thread

Please LOGIN to reply to this topic

COVID-19 Outbreak: WCMp team is supporting business affected by coronavirus

Read the Message Buy at Slashed Price