Search code examples
pythonwordpresswoocommercehook-woocommercewoocommerce-rest-api

Woocomerce webhook not being recieved


I am playing around with the webhooks of WooCommerce and i have setup a hook that triggers when an item is being added to a cart. enter image description here

I have a little Flask app that listens to requests and prints them out.

from flask import Flask, request, Response

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def respond():
    print(request.json);
    return Response(status=200)

This script is being run on the same machine as the Wordpress server. But when i add an item to my cart no calls are being made. Does anyone know what i am doing wrong?


Solution

  • I still am unable to trigger any webhook to an url that points to an service on the same machine. I tried running my endpoint in a docker container and addressing the ip address of the container. I also tried making custom dns entries in my host file. Still didnt work. Eventually fixed my problem by using ngrok.