Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Victor Bjørholm 58 posts 180 karma points
    Aug 04, 2020 @ 16:34
    Victor Bjørholm
    0

    Getting Address from Order ID

    Hi Matt,

    Is there a quick way to find the Shipping address using the order ID? I am getting the order ID from the OrderFinalizedNotification. I could not find anything in the Vendr Documentation about obtaining the address

    /Victor

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 04, 2020 @ 18:23
    Matt Brailsford
    0

    Hi Victor,

    The address is held in an orders properties collection using whatever property aliases you used to set them. With an order I’d you can fetch the order from the order service and get the address from it’s properties collection.

    Matt

  • Victor Bjørholm 58 posts 180 karma points
    Aug 05, 2020 @ 11:59
    Victor Bjørholm
    0

    Hi Matt, Sorry to ask but do you have a link for some documentation or an example? When looking at the order service at https://vendr.net/docs/core/1-2-0/reference/vendr-core-services/iorderservice/, I can not find any reference to a country property?

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 05, 2020 @ 12:28
    Matt Brailsford
    100

    Hi Victor,

    We don't have any concept of an address because it's completely up to you what you name them. What code are you using to set the address on the order?

    If you take a look at the demo store implementation you'll see the address is stored in the order properties https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore/Web/Controllers/CheckoutSurfaceController.cs#L86

    You can then access the value by reading the properties back

    var shippingAddressLine1 = order.Properties["shippingAddressLine1"]?.Value;
    var shippingAddressLine2 = order.Properties["shippingAddressLine2"]?.Value;
    var shippingCity = order.Properties["shippingCity"]?.Value;
    ...
    

    Maybe also try looking in the confirmation email template for another example of reading the values back.

    /Matt

  • Victor Bjørholm 58 posts 180 karma points
    Aug 06, 2020 @ 10:00
    Victor Bjørholm
    0

    Hi Matt, Thanks a lot! It is all working now!

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 06, 2020 @ 10:46
    Matt Brailsford
    0

    Fantastic. Glad we were able to get you there 👍

    /Matt

Please Sign in or register to post replies

Write your reply to:

Draft