I need to add IP Address of customer when order is getting created in Sitecore Commerce 9.0.2 from cart using OrderServiceProvider method.
The commerce engine already supports adding an IP address. However, currently there is no way to pass the IP through the default Commerce Connect pipelines.
The default AddCartLines implementation of the engine takes the IP address of the "GeoLocation" HTTP header and adds this to the ContactComponent of the cart. When you submit the order based on this cart, the contactcomponent with the IP will be copied to the order.
However the GeoLocation header does not get passed into the HTTP headers by the default connect implementation. As I see it, you will need to:
- Replace the default AddCartLines processor in the AddLinesToCart pipeline
- Have this processor use a custom version of the GetShopsContainer method that is part of the EngineConnectUtility class.
- This custom version adds the GeoLocation header with value: IpAddress=