Support » Plugin: WooCommerce » payment gateway Class not found

  • cmsbox.fr

    (@cmsboxfr)


    Hi,

    I’ve followed the instructions available here in order to upgrade my custom payment gateway:
    http://www.foxrunsoftware.net/articles/wordpress/migrating-your-plugin-woocommerce-2-0/#payment_gateways

    My plugin works perfectly on WC versions before 2.0.

    Following the instructions have fixed a few issues. However, I still get this error when I try to access WC payment settings after having installed the custom plugin:

    Fatal error: Class ‘woocommerce_myplugin’ not found in /…/woocommerce/classes/class-wc-payment-gateways.php on line 45

    I’ve changed hook registrations this way
    add_action( ‘woocommerce_api_’ . strtolower( get_class( $this ) ), array( $this, ‘myplugin_function’ ) );

    And finally, here is the beginning of my main plugin file:

    add_action('plugins_loaded', 'init_myplug_gateway', 0);
    
    function init_myplugin_gateway() {
    
        if ( ! class_exists( 'woocommerce_payment_gateway' ) ) return;
    
    	class woocommerce_myplugin extends woocommerce_payment_gateway {
    
    		public function __construct() {
    			global $woocommerce;

    What am I missing?
    Thanks a lot for any tip that could help me move on.

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • cmsbox.fr

    (@cmsboxfr)

    is there any free payment gateway example, or a complete tutorial for custom payment gateways in WC2?

    Max Rice

    (@maxrice)

    cmsbox.fr

    (@cmsboxfr)

    Hi, thanks a lot.
    Is this retocompatible with 1.x?

    cmsbox.fr

    (@cmsboxfr)

    The cheque example doesn’t use a payment response hook.
    In the old version of my plugin, I had this in the constructor, in order to trigger a function when the gateway sends a response:

    add_action(‘init’, array(&$this, ‘check_gateway_response’));

    In the default WC payment gateways, I’ve seen this for example:
    add_action( ‘woocommerce_api_wc_gateway_paypal’, array( $this, ‘check_ipn_response’ ) );

    I doesn’t work for my module, function not triggered.
    How can I trigger a function when the payment gateway sends an http response?

    Thanks a lot for your answers.

    cmsbox.fr

    (@cmsboxfr)

    Hi, what hook should be triggered in WC2 for payment response when the http response is sent by the payment server?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘payment gateway Class not found’ is closed to new replies.