Disclaimer: This website requires JavaScript to function properly. Some features may not work as expected. Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

ISiteContext

Explains how to get context objects for the current Storefront session.

Description

The context for the current Storefront session. The context includes objects like the current bill-to and ship-to customers, language, currency, website, and user. To obtain the current site context, you should use SiteContext.Current. This object is created new for each HTTP request.

Properties

BillTo

Gets the current bill-to customer.

Customer BillTo { get; }

CurrencyDto

Gets the current currency.

CurrencyDto CurrencyDto { get; }

DeviceType

Gets the current device type. This can be one of Desktop, Tablet, or Phone.

DeviceType DeviceType { get; }

FulfillmentMethod

Gets the current fulfillment method. This can be Ship or PickUp. If the Enable Warehouse Pickup setting is No, it will always be Ship.

string FulfillmentMethod { get; }

LanguageDto

Gets the current language.

LanguageDto LanguageDto { get; }

Microsite

Gets the microsite identifier for the current microsite. This only applies if the current user is browsing a microsite.

string Microsite { get; }

PersonaDto

Gets the current persona applied to the current user. This will only return an object if the current user has a persona applied.

PersonaDto PersonaDto { get; }

PickUpWarehouseDto

Gets the current PickUp warehouse. Used only when FulfillmentMethod is PickUp.

WarehouseDto PickUpWarehouseDto { get; }

RememberedUserProfile

Gets the remembered user profile. This will only return an object if the current user chose to have their account remembered when they are logged into the Storefront.

UserProfile RememberedUserProfile { get; }

ShipTo

Gets the current ship-to customer.

Customer ShipTo { get; }

UserProfile

Gets the current user.

UserProfile UserProfile { get; }

WarehouseDto

Gets the default warehouse for the current ship-to or bill-to customer. If a default warehouse can not be found, the default warehouse for the application is returned.

WarehouseDto WarehouseDto { get; }

WebsiteDto

Gets the current website being browsed by the user.

WebsiteDto WebsiteDto { get; }

Methods

IsUserInRole(string)

Indicates whether or not the specified role is assigned to the current user.

bool IsUserInRole(string roleName)

Parameters

  • roleName – The name of role. This can be a standard or custom role (not provided by Configured Commerce).

Returns

Returns true if the specified role is assigned to the current user.