1
abr4xas
8y

Hey, anyone here knows how to work with woocommerce webhooks? I need help with that 😀😀

Comments
  • 1
    Do you know anything about WordPress hooks?
  • 0
    @P3t3r6 no 😐😐
  • 0
    It's basically the same thing. If you look it up you'll find tons of info about it. Then you just have to find out which are the ones WooCommerce let's you use.
    If I'm not mistaken, all you have to do is:
    - Create a function that does what you want;
    - (Optional) Remove the default hooks behavior with the function remove_action();
    - Call the function add_action('hook_name', 'your_function_name');

    This is usually done in functions.php
    I'll paste an example.
  • 0
    This snippet removes the deafult product title in the loop and replaces it a <a> tag with the class .title

    remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10);
    function custom_template_loop_product_title(){
    ?><a href="" class="title"><?php echo get_the_title(); ?></a><?php
    }
    add_action('woocommerce_shop_loop_item_title', 'custom_template_loop_product_title', 10);
  • 0
  • 2
    Is this the new stackoverflow
  • 0
    @pretz No, but it is okay to try to help a fellow dev... Moreover it's not like he's asking about a bug or something...
  • 0
    Hey guys relax, thanks for the info... searching in Google found some info how to handle this hooks, basically, I need run a task to synchronize the stock from the web with a local server. if I'm not wrong, all I need to do is check the HTTP request body and then, run my task.
Add Comment