I use Dokan and WooCommerce. I want to hide the add to cart buttons on the products, so sellers do not have payment set up in their seller dashboard.
I have the following function, but it does not work:
add_filter( 'woocommerce_is_purchasable','woocommerce_available_payment_gateways' function( $show_cart, $product, $available_payment_gateways ) {
$seller_id = get_post_field('post_author', $product->get_id());
if(isset($available_payment_gateways( $seller_id )) {
$show_cart = true;
} else {
$show_cart = false;
}
return $show_cart;
}, 10, 2 );