WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
payment gateway Class not found (6 posts)

  1. cmsbox.fr
    Member
    Posted 1 year ago #

    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/

  2. cmsbox.fr
    Member
    Posted 1 year ago #

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

  3. Max Rice
    Member
    Posted 1 year ago #

  4. cmsbox.fr
    Member
    Posted 1 year ago #

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

  5. cmsbox.fr
    Member
    Posted 1 year ago #

    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.

  6. cmsbox.fr
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.