• Resolved maxiwp

    (@maxiwp)


    Hello,
    In the site im building i was trying disable/enable payment if the user country is us or canda

    WC()->payment_gateways->get_available_payment_gateways();

    i looked for example at:

    $gateways = WC()->payment_gateways->get_available_payment_gateways();
    $gateways['cod']->enable = 'no'

    this resulted for some reason to remove all available payment gateways. and know even if from the Payment>Settings after i enable different methods they are not working. is there a way to reset the payemnts getways? ive tried to update the woocomerce plugin, worpdress but nothing helps.

    thanks

    • This topic was modified 3 months, 2 weeks ago by maxiwp.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Stef

    (@serafinnyc)

    Hello @maxiwp you stated you are “building” are you custom coding a theme or something? This doesn’t sound like a default issue.

    Can you try switching to a default theme like Storefront and let us know what happens. Also please take a screenshot of your Payment settings area and post here so we can see what’s on and what’s off.

    Thread Starter maxiwp

    (@maxiwp)

    Hello @serafinnyc , yes this was a custom issue. i manage to make it work by using the.

    add_filter('woocommerce_available_payment_gateways', [$this, 'register_custom_payment_gateways']);

    in register_custom_payment_gateways i just added the payemnt options i needed and this worked! now, I can enable disable the different payments again from the settings page.

    again thx for reaching out!!, i been stuck with this for hours.

    Stef

    (@serafinnyc)

    Hello @maxiwp glad you found a solution that worked for you.

    Hey there, @maxiwp! Thanks for contacting us.

    I’m glad to know you found a solution for your issue.

    Thank you for sharing the solution here and contributing to the WooCommerce Community. This might help other users in the future.

    I’ll close this thread now, okay?
    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.