The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Discount Details

RohitRohit Member
in Bugs & Feature Requests edited September 25
I have added the coupon discount and completed the transaction. But I am getting null for "discount_details" in the json response in webhook. Order ID: 1620131990
Comments
  • fc_marijafc_marija FoxyCart Team
    Hi @Rohit -

    discount_details pertains to the item discount or category discount, rather than applied coupon codes.

    Here, you're using a coupon, so the discount information would be found under ["_embedded"]["fx:discounts"]. You'll need to loop through the discounts to get info about the applied coupons. You can see that here, under "fx:discounts" : https://wiki.foxycart.com/v/2.0/webhooks#example_payload

    I hope that helps ― feel free to let us know if you need further clarification.
  • Hi @fc_marija

    Thanks for your response.

    Under this ["_embedded"]["fx:discounts"] I have the "amount": ,"code": , "name": etc in the response. But "coupon details" which is like "incremental|1-20|100-0" is missing from the json response, what I need in the response. And is it possible to call webhook to store the coupon and its details during creating a coupon.
  • fc_adamfc_adam FoxyCart Team
    edited September 26
    @Rohit,

    To confirm, you're wanting to be able to tell what the original discount logic is that determined the discount amount, is that right? If so - while it's not included in the payload, the _links object within the fx:discounts node in the webhook does include the API URI for that specific coupon in ['_links']['fx:coupon']['href']. You could perform a GET on that to fetch the details you need.

    Could we confirm with you what you're looking to do, in case we can provide some different solutions for you?
    And is it possible to call webhook to store the coupon and its details during creating a coupon.
    We don't currently have webhook triggers for events from use of the admin. It is possible to use the API to get those details though (for example here's the coupons resource), but you would need to automate checking to see if any new or adjusted coupons are present on the store.
Sign In or Register to comment.