Skip to content Skip to sidebar Skip to footer

Django Signals With Shopify Webhooks

I am new to Django signals and Shopify webhooks, but I want to implement this feature in to a project. I am using this package, which also includes a set of WebhookSignals, to rece

Solution 1:

For what it's worth, I'd recommend just using the @webhook decorator directly on a view instead of unnecessarily complicating things with signals.

This is how your view would look:

from shopify_webhook.decorators import webhook
from myapp.models               import AuthAppShopUser

@webhookdeforders_create(request):
    user = AuthAppShopUser.objects.get(myshopify_domain=request.webhook_domain)
    order_data = request.webhook_data
    # The rest of your view here

The above example assumes that you're using django-shopify-auth for your user authentication, and have set up the user model AuthAppShopUser in accordance to its documentation. You'll also want to be sure that you've registered the view to a url pattern within your urls.py, and also registered the webhook to the store via the Shopify API.

Post a Comment for "Django Signals With Shopify Webhooks"