• Hi all,

    is there a safe way to define payment methods per product category in WooCommerce?

    My client has some products that can only be bought using COD, while most products in the shop also accept credit cards and even payment on the premises.

    I’ve searched the plugin pages and haven’t found anything yet.

    Thanks a lot in advance for any help or hint.

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m trying to convert this code to product_category:

    add_filter('woocommerce_available_payment_gateways','filter_gateways',1);
    
    function filter_gateways($gateways){
    global $woocommerce;
     foreach ($woocommerce->cart->cart_contents as $key => $values ) {
    //store product id's in array
    $highpriceditems = array(56,57);			
    
      if(in_array($values['product_id'],$highpriceditems)){	
    
                                        unset($gateways['paypal']);
    break;
                                    }}
    return $gateways;
    }

    From this post

    @qrafts – I added code that does what you want to the post you referenced.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘payment methods by product category’ is closed to new replies.