Locale change in the storefront doesn't immediately reflect in the functions input

Steps:

  1. Set the cart up so that a discount functions executes.
  2. Check the value of locale ISO code provided in input from function logs.
  3. Change the locale code on the store front
  4. Check the logs, the value would still be the old locale code.