Copied to clipboard

Flag this post as spam?

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


  • Edgar Rasquin 326 posts 925 karma points
    Feb 18, 2021 @ 11:37
    Edgar Rasquin
    0

    Custom field in billing address

    Hi,

    is it possible to add custom fields to the billing address? I would need to add the "taxnumber" as a mandatory field.

    Thanks

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 18, 2021 @ 11:56
    Matt Brailsford
    0

    Hey Edgar,

    In terms of just literally adding extra fields, you can store whatever you want in an orders properties collection, so if you need to store your tax number, you can store that in a custom property on the order.

    I'm guessing there is more to this question than this though and you might be referring to showing it in the back office, or you might be referring to capturing the extra field with Vendr Checkout.

    If you need further info, please clarify where / how you wish to use that property.

    Matt

  • Edgar Rasquin 326 posts 925 karma points
    Feb 18, 2021 @ 12:01
    Edgar Rasquin
    0

    Hi Matt,

    thanks for your immediate reply.

    Yes, I would need to display it in various places:

    • VendrCheckoutReviewPage.cshtml
    • backoffice order
    • Confirmation Email

    Thanks

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 18, 2021 @ 12:17
    Matt Brailsford
    100

    Hi Edgar,

    Ok, then:

    1) You can't extend Vendr.Checkout with custom properties. It is meant as a simple drop in solution for people that need a quick setup. As soon as you need anything custom, you'll need to create your own checkout flow. You can use the Vendr.Checkout source as a basis though as this is all on GitHub https://github.com/vendrhub/vendr-checkout. Essentially though, you'll need to add an extra field to capture "taxnumber" and then when you call AddProduct on the order, you'll pass this through as an additional property ( https://vendr.net/docs/core/1-4-0/reference/vendr-core/orderextensions/#addproduct-3-of-8 ).

    2) We don't have a way to extend the customer details dialog, but what you can do, and what we do on our vendr site is to display these extra properties in the "Addition Info" section in the bottom right hand side of the order edit screen. These can be added to using the order editor config file documented here https://vendr.net/docs/core/1-4-0/key-concepts/order-editor-config/ (You'll want to read this generally, but the bit specific to Additional Info is under the heading Additional Info Config Options)

    3) Assuming you are using the Vendr.Checkout OOTB email templates, again, you'll need to swap these for custom ones. You can copy the ones from Vendr.Checkout and update these to output the extra property you have captured. All emails have access to the order entity and so you can access the custom property you capture in it's properties collection. You can then render that out however you see fit.

    Hope this helps

    Matt

  • Edgar Rasquin 326 posts 925 karma points
    Feb 18, 2021 @ 17:11
    Edgar Rasquin
    0

    Hi Matt,

    1) do I need to uninstall vendr-checkout nuget package and instead add the Vendr.Checkout.csproj project to my Visual Studio solution?

    2) "Addition Info" section is fine for me

    3) I think I will manage to do so

    Thank you

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 19, 2021 @ 09:41
    Matt Brailsford
    0

    Hi Edgar,

    You could fork the code for the Vendr.Checkout project and update this independently. You could then use it's build script to generate a bespoke package that you could then install over the top of the existing Vendr.Checkout package. I believe this should do the trick.

    Hope this helps

    Matt

  • Edgar Rasquin 326 posts 925 karma points
    Feb 22, 2021 @ 09:08
    Edgar Rasquin
    1

    Thank you Matt.

    Works as described!

    Have a nice day.

    Edi

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 22, 2021 @ 09:10
    Matt Brailsford
    0

    Hey Edgar,

    Glad to hear you got it all working 👍

    Matt

  • Warren Harding 132 posts 275 karma points
    Dec 23, 2021 @ 03:39
    Warren Harding
    0

    Hi folks, I feel like I'm missing a few steps here and was hoping you can help...

    Looking in the Vendr Orders: Commerce > Stored > Orders I don't see these details (this is a standard install so far)

    enter image description here

    But I've continued on in the hopes that it would appear - and trying to test updating order.editor.config.js, I have added the following:

    enter image description here

    I've then added the following to VendrCheckoutInformationPage.cshtml to test it:

    enter image description here

    Does this automatically pickup the order properties and assign it to the order on postback or is there a custom controller I need to inherrit? And how would I go about implementing this?

    Thank you for your help, Warren

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Dec 23, 2021 @ 10:09
    Matt Brailsford
    0

    Hi Warren,

    Properties don't automatically get added to an order, they need to be handled in surface controller that adds the product to the order. For Vendr checkout this is here https://github.com/vendrhub/vendr-checkout/blob/v2/dev/src/Vendr.Checkout/Web/Controllers/VendrCheckoutSurfaceController.cs#L132 but in order to handle custom properties, you'd need to run your own build to handle that additional property.

    I guess it could be a nice feature for us to support defining custom properties somewhere to say there are some other custom properties to automatically add to the order. I'll add it to the issue tracker, but it's not going to get looked at till the new year now. In the meantime, as mentioned above, your only option is to run your own custom build handling the additional properties in the surface controller outlined above.

    Hope this helps

    Matt

    UPDATE: Vendr Checkout feature request is here https://github.com/vendrhub/vendr-checkout/issues/26

Please Sign in or register to post replies

Write your reply to:

Draft