Support » Plugin: Woo Credits » Disabling certain gateway for the credits tier purchase

  • So I am using the free version (but hoping to go premium soon if all goes well). The issue I have currently run into is a wish to disable a certain gateway (Fortumo mobile pay) as its uses a hardcoded price system which is only good enough for single products and not credits pack. I am able to do this for standard Woocommerce products but not the credits packs. The page attached below is just so you could see the Fortumo gateway after click ‘Request the link’

    Thanks

    • This topic was modified 1 year, 10 months ago by mkerv.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author brandonmuth

    (@brandonmuth)

    Hi, thanks for post. We are not familiar with the Fortumo gateway, however, if you wish to disable it, can you simply disable it as a plugin? Also, when I hover over the “Request the link” button on the site, I don’t see a URL preview of where it’s taking me, so I’m hesitant to click it. Can you provide a screen shot or description of what happens after that is clicked?

    Plugin Author brandonmuth

    (@brandonmuth)

    Ok, it looks like “Request the link” is simply the “Add to cart” functionality. I see 8 payment gateways once I’ve added a product to the cart. If you want to hide Fortumo as a gateway, it seems you could add following to style.css file:

    li.wc_payment_method payment_method_fortumo {display: none;}

    That would hide it from view, essentially eliminating it as an option for users to select. Hope that helps!

    • This reply was modified 1 year, 10 months ago by brandonmuth.

    Thanks for the reply. I wish to have Fortumo hidden only when users are purchasing the credits tier(s) – because the price I have set for Fortumo is only good enough for one file and not more. If I understand right, I will need to add the suggested code to the Plugin’s css and not otherwise. Thanks again.

    P.S A noobish interpretation of me it seems. The plugin does not seem to have a css file (of cause unless if it is just something above my head). Yes I normally Google my way through web dev’ing with no real skill therein. So I do not know (amonsgt others) how exactly a plugin works behind the scene but with a pointer (if possible), I trust I can get it done. And I will also understand if it is simply just not possible at the moment 🙂

    • This reply was modified 1 year, 10 months ago by mkerv.
    • This reply was modified 1 year, 10 months ago by mkerv. Reason: Point out my possible interpretation error

    With standard Woocommerce products, I use the category ID (and I am not sure if this could also be possible with a product ID but I could look into that) which brings me to wonder if the credits pack/tiers are assigned IDs somehow or if it was never necessary. Yes I do not think they have/need categories (open for correction).

    Tried to look into the product ID option and I found that unsetting by product type was also possible. Looking at the plugin’s php seemed to suggest to me that the credits have their product type as ‘credits’. I then found this one filter example via Google. From which I mumbled up the following filter and it seems to work (used with the My Custom Functions plugin):

    add_filter(‘woocommerce_available_payment_gateways’, ‘conditional_payment_gateways’, 10, 1);
    function conditional_payment_gateways( $available_gateways ) {

    foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    $prod_credtis = false;
    // Get the WC_Product object
    $product = wc_get_product($cart_item[‘product_id’]);
    // Get the product types in cart (example)
    if($product->is_type(‘credits’)) $prod_credits = true;
    }
    if($prod_credits)
    unset($available_gateways[‘fortumo’]);

    return $available_gateways;
    }

    A cleanup pointer would still be greatly appreciated. I really appreciate the plugin’s availability and should go premium/platinum soon indeed.

    Thanks

    • This reply was modified 1 year, 10 months ago by mkerv.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disabling certain gateway for the credits tier purchase’ is closed to new replies.