Ready to get started?Download WordPress


WooCommerce - excelling eCommerce
Calling Woocommerce Ajax Hooks inside plugin (4 posts)

  1. alvaron
    Posted 11 months ago #

    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!


  2. Roy Ho
    Posted 11 months ago #

    Those are not hooks per say...

    What you want to use is probably this:

  3. alvaron
    Posted 11 months ago #

    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

  4. Roy Ho
    Posted 11 months ago #

    "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?


You must log in to post.

About this Plugin

About this Topic