Title: Conditional payment methods
Last modified: January 10, 2022

---

# Conditional payment methods

 *  Resolved [TC.K](https://wordpress.org/support/users/wp_dummy/)
 * (@wp_dummy)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/conditional-payment-methods/)
 * I want to have conditional payment gateway based on the cart total amount.
 * eg: for amount > 10 , use cc and local gateways (eg fpx, grabpay etc)
    else use
   CC only.
 * I have tried your hooks, `wc_stripe_available_payment_gateways`
 *     ```
       add_filter('wc_stripe_available_payment_gateways', 'remove_mobile_pay', 99999);
       function remove_mobile_pay($gateways){
           $total = WC()->cart->total;
       }
       ```
   
 * But the `$total` give me 0 values. I have tried `WC()->cart->get_cart_subtotal()`,`
   WC()->cart->cart_contents_total` , `WC()->cart->subtotal` , All these hooks giving
   zero (0) amount.
 * What did i done wrong?
    Or any other methods to have conditional gateways?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Clayton R](https://wordpress.org/support/users/mrclayton/)
 * (@mrclayton)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/conditional-payment-methods/#post-15234525)
 * Hi [@wp_dummy](https://wordpress.org/support/users/wp_dummy/),
 * There isn’t a filter named `wc_stripe_available_payment_gateways` in this Stripe
   plugin.
 * I recommend you use the filter `woocommerce_available_payment_gateways` instead.
 * Kind Regards,
 *  Thread Starter [TC.K](https://wordpress.org/support/users/wp_dummy/)
 * (@wp_dummy)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/conditional-payment-methods/#post-15234611)
 * Oh, my mistake.
    It is `wc_stripe_payment_gateways` hook.
 * But neither `woocommerce_available_payment_gateways` and `wc_stripe_payment_gateways`
   works. Still having the same 0 amount issue from the cart object.
 *  Plugin Author [Clayton R](https://wordpress.org/support/users/mrclayton/)
 * (@mrclayton)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/conditional-payment-methods/#post-15237623)
 * [@wp_dummy](https://wordpress.org/support/users/wp_dummy/) don’t use filter `
   wc_stripe_payment_gateways` for what you’re trying to do because it’s too early
   in the WooCommerce loading cycle for the cart to have data.
 * The cart’s totals aren’t calculated until after the checkout shortcode is called.
 * The fact that your cart’s total is zero in the `woocommerce_available_payment_gateways`
   has nothing to do with the Stripe plugin. I’d make sure you have an item in your
   cart etc.
 * You can always call `WC()->cart->calculate_totals();` in your custom function
   to ensure the cart totals have been calculated. There will be a performance hit
   to consider though.
 * Kind Regards,
    -  This reply was modified 4 years, 4 months ago by [Clayton R](https://wordpress.org/support/users/mrclayton/).
 *  Thread Starter [TC.K](https://wordpress.org/support/users/wp_dummy/)
 * (@wp_dummy)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/conditional-payment-methods/#post-15238616)
 * i found the problem, it was not from this plugin.
    Thanks for the help though.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Conditional payment methods’ is closed to new replies.

 * ![](https://ps.w.org/woo-stripe-payment/assets/icon-256x256.png?rev=2611337)
 * [Payment Plugins for Stripe WooCommerce](https://wordpress.org/plugins/woo-stripe-payment/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-stripe-payment/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-stripe-payment/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-stripe-payment/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-stripe-payment/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-stripe-payment/reviews/)

## Tags

 * [gateways](https://wordpress.org/support/topic-tag/gateways/)

 * 4 replies
 * 2 participants
 * Last reply from: [TC.K](https://wordpress.org/support/users/wp_dummy/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/conditional-payment-methods/#post-15238616)
 * Status: resolved