Current User Method for Bigcommerce

I would like to create a current user method for my Bigcommerce site/store. Is this possible?

For example:

if (current_user === XYZ_user) {
  do this
}  else {
  do this other thing
}

Thank you for your time!


ANSWERS:


I'll answer the most immediate question, and I'll assume you're not using the new Stencil platform.

Use the %%GLOBAL_CurrentCustomerFirstName%% and %%GLOBAL_CurrentCustomerLastName%% variables that you see here:

Stealing your pseudocode:

var XYZ_user = 'BobJohnson'
var current_user = '%%GLOBAL_CurrentCustomerFirstName%%%%GLOBAL_CurrentCustomerLastName%%'
if (current_user === XYZ_user) {
  do this
}  else {
  do this other thing
}

These variables are available on every page, whereas certain other variables like the email address have incomplete availability.

However, it might be better to put these customers into a group and use the %%GLOBAL_CustomerGroupId%% variable instead. You can get the customer group ID via the API or by looking at the URL in the control panel when editing that group.

For example:

if (%%GLOBAL_CustomerGroupId%% === 4) {
  do this
}  else {
  do this other thing
}


 MORE:


 ? Bigcommerce stencil suggested cart content
 ? BigCommerce Stencil: How do I modify the HTML of a Theme already applied to the store?
 ? Adding weight and volume to woocommerce products
 ? Woocommerce show shipping methods in checkout page?
 ? Add a step to WooCommerce Checkout
 ? Merging git repo's and suggested workflow
 ? Merging git repo's and suggested workflow
 ? Merging git repo's and suggested workflow
 ? Swedish Saas e-commerce solution with nice API and integration with Klarna
 ? php e-commerce store which supports large volumes of product variables