Support » Plugin: WooCommerce » php function to query if in test mode ?

  • Resolved chchch

    (@goch)


    Hi

    I’m looking for the php function that I can call to query if woocommerce is in “Test Mode” or “Live Mode” but I could’t find it. Can anyone point me to it?
    Thanks!

    (I’m trying to move away from ‘easy digital download’ and set up ‘woocommerce’. I was using edd_is_test_mode() in one of my script so I’m looking for the woocommerce equivalent).

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Adam

    (@adamkheckler)

    WooCommerce itself does not have a “test mode”, but some payment gateways do, e.g. Stripe:

    https://docs.woocommerce.com/document/stripe/#section-25

    … which you can check using your own code, perhaps like so:

    
    $woocommerce_stripe_settings = get_option( 'woocommerce_stripe_settings', array() );
    
    if ( 'yes' === $woocommerce_stripe_settings['testmode'] ) {
    	// Do some stuff in test mode :)
    }
    
    

    There are many payment gateways, both made by us and third-party, so you’ll need to look into the specific ones you’re using to find whether they have a test mode or not.

    Hope that helps! 🙂

    exactly what I needed. thanks!

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