WordPress.org

Support

Support » Plugins and Hacks » WooCommerce » Calling Woocommerce Ajax Hooks inside plugin

Calling Woocommerce Ajax Hooks inside plugin

  • I’m developing a plugin to allow custom shipping taxes added by wp-admin.

    Everything seems good except the fact, that the hooks wp_ajax_nopriv_woocommerce_update_order_review and wp_ajax_woocommerce_update_order_review seems not to work from inside the plugin code.

    I mean, whan I call this hooks from theme’s functions.php it all works perfectly, but when I call inside the plugin, something like //add_action( ‘wp_ajax_woocommerce_update_order_review’, array( &$this,’add_custom_shiptax’),10,2);
    //add_action( ‘wp_ajax_nopriv_woocommerce_update_order_review’,array( &$this,’add_custom_shiptax’),10,2); it works before the ajax update the shipping calculator, but when it is done, it deletes my custom ship tax.

    Any help, please?

    Thanks in advance!

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Roy Ho

    @splashingpixelscom

    Those are not hooks per say…

    What you want to use is probably this:

    'woocommerce_checkout_update_order_review'

    Thanks for your reply Splashing, but it’s the same, just works from the theme’s functions, when I put it inside the plugin php, it fails…

    But thanks for your reply

    Roy Ho

    @splashingpixelscom

    “it fails”…doesn’t really help explain what your issue is. If it works in theme’s functions and not in plugin, it is a good sign that your priority is wrong. Try setting a higher priority number so it is executed later…

    Also did you check the data that is passed into the callback of the hook I mentioned?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Calling Woocommerce Ajax Hooks inside plugin’ is closed to new replies.
Skip to toolbar