Salesforce Commerce Cloud (B2C) Interview Question & Answers

1)Which product types are there in SFCC?

Standard, base(master), variation group, variation product, product set, product bundle.

2) What is the difference between a product set and product bundle?
Product set elements can be purchased separately, while product bundle elements are not.

3) When the base(master) product is considered as orderable?
If base(master) product has no its own inventory record — If at least one of its variants is in orderable or in stock. If base(master) product has its own inventory record its availability is calculated on its inventory record.

4) What is the difference between product(master) catalog and storefront catalog?
The product(master) catalog provides the same structure as an external system of record for your products. This catalog isn’t assigned to a site. It owns the products you want to merchandise, and it mirrors the organization of your inventory, fulfilment, or product management systems.
The storefront catalog is where you create categories that appear on your storefront. Products must be assigned to storefront categories to show on the storefront.

5) How many storefront catalogs can be assigned to a site?

Only one

6) What steps should be done to display new category on storefront
Create a category in the storefront catalog, set online to yes, set the “display in storefront navigation“flag to yes, assign products to this category, rebuild search indexes.

7) If we have 2 different price books (usd-regular-prices, usd-sale-prices) assigned to a site, and they both have a price for a single product (usd-regular-prices — 50$, usd-sale-prices — 45$). Which price will be used for the product?

45$ from usd-sale-prices — the lowest price is used.

8) What is the main condition to assign more than one price book to a site? 

Currency should be the same.

9) Is it possible to set activation dates for price tables in SFCC?

In price table settings you can hit “Continuous” option which will open the context menu with date picker for price table

10) What is a Business Manager in SFCC?
Business Manager in general is the main tool (GUI) for configuration of the SFCC platform.

11) What is a campaign in SFCC?
Campaign is a container for multiple user experiences, triggered by qualifiers.

12) What is Promotion in SFCC?
In B2C Commerce, a promotion contains a rule that defines the type of promotion, conditions, and discounts, and can be extended with custom attributes to support your business requirements.

13) List all promotion classes in SFCC.
There are 3 of them: 

1) Product 

2) Shipping 

3) Order.

14) If you delete a product, category, or shipping method that is associated with a promotion, would the promotion be deleted also?
No.

15) Is it possible to apply product discount without promotion in SFCC?
Yes, we can do this for example with assigning another price book with lower price to product.

16) What is promotion exclusivity?
Promotion exclusivity attribute defines is it possible to combine current promotion with other promotions.

17) Can we set the product set as the product promotion qualifier?
No, product sets aren’t supported as product promotion qualifiers or discounted products.

18) What are supported data types for content assets in SFCC?

Images, HTML, strings, text, or numeric content.

19) What is content slot configuration?

It is a specific tab for content slots, where you pick the rendering template, assign data and set slot schedule.

20) How can we identify the all-content slots which are located on our storefront?
We should use the content information tool, located in the top left corner of our storefront.

21) A merchant has a requirement to have new order comments attribute in their checkout flow. The new attribute needs to be included as part of the standard order export, so that business users in the merchant team can see order comments. Aside from updating the HTML markup and form definition, which option contains all necessary steps to achieve this task?

Create a new custom object type for order comments that contains the attributes: order ID and comments then modify the Checkout Services controller to create a new order comments custom object upon order completion.

22) A developer needs to share their sandbox data with a colleague working on the same realm. What is best practice to share data between two environments?
Perform a site export using the global export directory

23) An instance has custom logging enabled. The log reaches the file size limit. What happens next?
Logging is suspended for the day.

24) A merchant wants customers to be able to order gift cards via their site. This item should be available to order at all times, as they can handle an unlimited number of orders for these digital vouchers.
Check the perpetual flag in the product inventory record.

25) A developer implements a storefront website for a French company, that sells its goods primarily in EU, but also in USA, GB and Japan. Which currency should be selected for the Default Currency setting?
It should be EURO, bc it doesn’t matter for how many countries the site is going sell its goods, if their primarily focus is on European Union, client is Located in France and follows the European Union policies.

26) What is the best way to deploy catalog to a production instance?
Create catalog on staging instance, replicate it to development instance for testing and once tested you replicate it to production instance from staging

27) What happens when you assign a catalog to a site which already has catalog assigned?
Previous catalog is automatically unassigned

28) When importing a catalog through a CSV file, would the new catalog be created?
No, a CSV file can only update a catalog. The import process can’t create a new catalog from a CSV file

29) When exporting catalog through a CSV file, is it possible to export product bundles?

No, the CSV export only contains product attributes and does not include columns for product bundles.

30) What is the best practice to make sure that your catalog CSV file fits for the SFCC standards?
Export a catalog first and modify it with your changes, then navigate to catalog import and select which catalog you want to update during the import process, also make sure all your attributes are valid before beginning the import process.

31) Is it true that we can assign products to only one category inside storefront catalog?
No, we can assign product to more than one category.

32) What is Rule-based categorization?
Rule-based categorization rules automatically assign all products that fit a criteria to a category. You create rule sets to establish these criteria and all products that fit the criteria are automatically assigned to the category

33) When product inherits the category attributes?
If category is designated as the primary category for a product, that product inherits the assigned category attributes.

34) Can we copy the category without copying the products assigned to this category?
Yes. For example, you want to create a Flash Sale category for climbing gear and you have a Climbing Gear category already defined with product assignments. You can

copy the Climbing Gear category without its products, and preserve the category attributes, product attribute definitions, search refinement definitions sorting rule, and page meta tag rules of your original Climbing Gear category in the Flash Sale category.

35) Is it possible to schedule a category to be shown on a storefront within a specific time?
Yes, you just navigate to category you want to schedule and set date and times for Online From and Online To.

36) Which product attributes can be used as search criteria on your storefront?
Every product attribute, including custom attributes, which is specified in your Search Refinement Definitions.

37) What for do we need Page Meta Tag Rules tabs in SFCC?
Page meta tags are used in HTML documents to provide structured data about a web page. Meta tags don’t appear on the page itself, but in the page code, describing page content and making it easy for web crawlers/search engines to populate your page in search results

38) Given a task to implement new product type – cologne, with available volumes
0.2 and 0.3 L, what are the steps to implement this feature?

You should add new custom attribute — volume (with type set of strings) for a product system object,
DO NOT MARK IT AS required, next make it searchable by adding it to search refinement definitions, create demo product if needed, assign it to category, hit indexes rebuild and good to go.

39) What are slicing rules in SFCC?
Slicing rule is used to determine whether the variation product appears as a single search result with a single image or is sliced and appears with a search result for each variation product with its own image

40) What is the difference between UUID and ID?

UUID is SFCC internal id, which it assigns to every single object for reference, ID is the identifier configured by merchant.

41) What are product options?
Product options enable you to sell configurable products that have optional accessories, upgrades, or extra services, e.g., warranty, post purchase support, additional software and etc.

42) If we are having missing or invalid Product Attributes, how does it affect our storefront?
This status doesn’t affect the storefront except that the attributes don’t appear; all functionality still works.

43) Is it possible to edit multiple products at the same time in SFCC?

 Yes, SFCC supports that feature, it is called bulk edit.

44) How to exclude unavailable products from search results W?
Use the Show Orderable Products Only search preference to control at the site-level if unavailable products appear in search results.

45) What is Product Grid View?
The product grid view is a visual reference of your product page. In the grid view, you can drag products to modify their order on the page. The grid view shows how changes you make to the product order are shown on your storefront.

46) A cosmetics merchant wants to bundle five separate skin care products into a comprehensive beauty regime. What is the best way to achieve this?
Create a product bundle with these 5 products. Since merchant is still selling those 5 different items separately there is no point to combine them into product set, but when using a bundle customer is available to buy any of those
separately or with 1 click add all items to his cart.

47) What is the main purpose of products dashboard in SFCC?
Use the Products dashboard to review metrics about your top-selling products and gift certificates.

48) What is the difference between classification and primary categories?

Classification category–In the storefront catalog, the classification category determines what attributes appear for the product. In the catalog that owns the product. You manage product in this category.
Primary category–The category where the consumer searches for the product. This category is in the storefront catalog, and sets which attributes are used to define the product.

49) What is SKU Coverage in SFCC?
SKU Coverage is the normalized ratio between the total number and the number of available variations of a base product.

50) Is SKU Coverage site specific?
A. SKU Coverage is the same for all sites that share an Inventory list, so it’s a site- specific value.

51) How to create a job in business manager?
You should navigate to Administration tab in business manager and select jobs under operations section. Next click new job button, enter an ID and description, and click create, also do not forget to add at least one flow

52) What is job priority in SFCC new job framework?
It is redundant attribute which should be ignored. The Priority feature isn’t supported.

53) Can jobs be scheduled?
Yes. but this feature is not supported on sandboxes instances (only for Primary Instance Group)

54) What is on-demand sandbox?
An on-demand sandbox is a public-cloud-based sandbox. When you use on- demand sandboxes, you can expand your sandbox usage when required and roll back usage during slow periods.

55) How much instance types are there in SFCC?
There are 4 of them — Sandbox, Staging, Development and Production.
Depending on the type, the instance is either in the realm’s primary instance group (PIG) or a secondary instance group (SIG)

56) What is primary instance group (PIG)?
It is a group of 3 realms — Staging, Production, and Development.

57) What is secondary instance group (SIG)?
The instance which includes only Sandboxes instance types in it

58) What is an SFCC Administrator role and instance type?
An admin is responsible for granting access to instances and functionality on instances. The admin restarts instances, manages data feeds, and uploads certificates.

59) What is SFCC developer role and instance type?
A developer creates or modifies templates, pipelines, and scripts on a local machine and uploads them to a Sandbox instance to test. Ultimately, the developer is responsible for uploading code to the Staging instance. The developer can also export data added by merchandisers on the Staging instance to use as test data for the sandboxes.
Instance type: Sandbox, Staging
Note! Developers never use the Development instance unless they are involved in the testing process for the production site.

60) What is SFCC QA Engineer role and instance type?
This role is responsible for testing the site in conditions as close to production as possible.
Instance type: Development only
No any code development is done on the Development instance.

61) What is B2C merchandizer role and instance type?
A merchandiser or online marketer is typically responsible for creating campaigns and promotions, managing product information, and configuring search behaviour.

Instance type: Staging only

62) What is Staging Instance purpose in SFCC? 

It is used to test your site before deployment.

63) What is Development instance purpose in SFCC?
It is used for site configuration, data enrichment, and data import.

64) What is Production instance purpose in SFCC? 

It hosts the live site that is used by customers.

65) What is realm?
In general, realm is a container for all your instances including Primary Instance Group (PIG) And Secondary Instance Group (SIG).

66) Can we have multiple realms in SFCC?
In most cases, you have a single realm in which you can develop, stage, and deploy multiple sites with different branding or locales. The people managing the storefront site don’t have to be in the same location. Sites can share product catalogs or have different catalogs.
Note! If you have different lines of business or global teams that each have their own processes or business policies, consider maintaining multiple realms. You can also have separate realms if you have distinct organizations with separate back-end integrations, schedules, or other concerns that make it advantageous to let each team manage their sites independently. Sites in the same realm can share the product catalog for product data. Sites in different realms can’t share data through the catalog structure. However, you can share data by importing it into different realms.

67) What is the minimum and maximum number of Sandboxes which can be created in Secondary Instance Group?
The minimum number of sandboxes in a SIG is 3, and the maximum is 47.3??? 

68) What are software deployment stages in SFCC?
The software deployment stages for B2C Commerce development include Sandbox, Build and Merge, Staging, Development, and Production.

69) What is quota in SFCC?
Quotas are part of the Demandware Platform. They are used to monitor platform resource usage in custom code. Platform resources include memory, application server threads, database table sizes, and so on. Typically, when a quota is exceeded, custom code is using platform capabilities inefficiently, and a more efficient solution is possible.

70) How many quota types are there in SFCC?

There are many quota types, which can be grouped into API and Object quota.
The Demandware Platform was designed to be used as an ecommerce system. With that usage scenario in mind, certain constraints and limits were set during design and implementation to ensure the efficiency and stability of solutions built on top of the platform. These limits concern memory usage, resource consumption, API calls, and the number of business objects.

71) What happens when a quota is exceeded?
A quota is either “enforced” or “not enforced.” If an enforced quota is exceeded, an exception is thrown, which prevents the current operation from completing. The exception cannot and should not be caught within the customization. The design criteria must be avoidance of quota violations. Examples for quota violations are:
• a Collection with too many elements was created in memory, or
• too many persistent objects of a certain type were created in an instance.
If an enforced quota is exceeded in a storefront request, the general error page appears. If an enforced quota is exceeded during a standard import, a Data Warning or Data Error is reported. If a quota is not enforced, the platform does not take an action when the limit is exceeded.

72) What are API quotas?
API quotas may define limits on number of object instances, object sizes, runtimes, number of executions per page, or prevent the execution of a B2C Commerce Script method or pipelet in the storefront.

73) What are Object quotas in SFCC?
Object quotas and object relationship quotas define a limit on the number of objects. Object quotas typically limit the number of objects of a particular type per instance. Object relationship quotas limit the number of objects that may be associated with one object of that type.

74) What is SFCC Model-View-Controller (MVC) Architecture?
Software architectural model whereby the underlying data (model) is separate from the user interface (view), so that changes to the user interface don’t affect data handling, and data can be reorganized without changing the user interface. The decoupling of data access and business logic from data presentation and user interaction is facilitated by a controller.

75) What is an SFCC Storefront?

Your online ecommerce site powered by B2C Commerce. A single instance can include multiple storefronts.

76) What for do we need <isinclude> isml tag?
To include the contents of one template inside another or the contents of another URL.

77) Can we include both URL and template path in one single<isincude> tag?

 You must include either template or URL, but not both.

78) What is the maximum include depth in SFCC? 

The maximum include depth is fixed to 10.

79) Can remote include other remote includes?
Yes, remote includes can include other remote includes.

80) What should we do to include text string in our templates instead of hard- coding them?
We can use the Resource class methods.

81) How can we implement page caching in SFCC?
You can enable page caching in Business Manager; and use the <iscache> ISML tag within a template to control what parts of a page are cached and for how long.

82) When caching should not be used? 

If the page data is frequently updated.

83) What is static page content in SFCC?
Web page elements such as HTML headings and text, images called with HTML tags, and any other part of the page that is unaffected by the ISML conversion process, are considered static content.

84) What is dynamic page content in SFCC?
When ISML tags call variables to generate a specific list at run time (for example, a list of products), they look up object properties in the Pipeline Dictionary to present product details or other session-dependent data dynamically. This is called dynamic content.

URLs are another example of dynamic content. The system parses this information at run time to compose content that changes from session to session.

85) How you can pass certain product into res.render() method to access it later in template by variable my Product?
res.render(‘template_path’, {myProduct : product}).

86) What is <ismodule> tag used in ISML?
Build units of reusable template functionality that are inserted into the template using custom ISML tags.
When <ismodule> specifies a template, the specified template is included and user defined attributes/custom ISML tags are accessible.

87) How can you ensure that a script expression is HTML encoded?
You must set the included page’s content type to text/html via the following statement: <iscontent type=”text/html” charset=”UTF-8″ compact=”true”>

88) What are custom hooks in SFCC?
They are custom extension points which can be called in your storefront code using the B2C Commerce script System package HookMgr class methods. You can then access the hook in either OCAPI or your storefront code. This flexibility makes them useful for functionality in a multichannel set of applications based on the same site.

89) If there are multiple modules to call in one extension point, how can we control their order of execution?
We can’t control the order in which the modules are called.

90) If you call multiple modules in one single hook, which value will be returned? (Let’s pretend that all modules have return statement)
Only the last hook returns a value.

91) How can we manage hooks execution order?
Hooks are executed in the order of the cartridges on the path. Therefore, when you change the order of the cartridges, you also change the order of hook execution.

92) Why should we be cautious when using hooks?

Because unprivileged users can make privileged OCAPI or method calls. Also, because of the design placement of OCAPI hooks, a developer can inadvertently modify API calls to accept no authentication or to bypass expected authorization entirely.

93) What are shop API accepted request methods? 

GET, POST, PATCH, DELETE, PUT.

94) What are log files in SFCC?
Log files capture information about system resources, performance, errors, and quotas.

95) Which roles can view SFCC logs? 

Site admin and developer

96) How many log levels are there in SFCC? 

There are 5 of them:
info 

error 

warn 

debug 

fatal

97) How many custom log names can we have in SFCC?
SFCC allows only 40 different log file names (therefore, 40-log instances and log files) per day. This quota is a hard limit and is counted per App server.

98) How can we identify that log is for web service?
The log file name for a web service always starts with “service”. E.g., service-logprefix-blade2–4-appserver-20150206.log

99) What is security log in Salesforce B2C commerce? 

Security log contains log entries for Business Manager logins.

100) When security log is deleted and can we delete them manually?
Security log files are automatically deleted after 90 days. Users and clients can’t delete security logs, or turn off security logging.

101) How can we get parameter with name addressId from query string in controller endpoint?
req.querystring.addressId

102) How can we perform a null-check in SFCC?
We can use empty(object) operator. Example: empty(addressId).

103) Which controller method should we use to overwrite the functionality? 

server.replace

104. How can we get complete url path when we know only controller name and endpoint ? Let it be Account-Login.
We should use the URLUtils package and it’s method called url. For Account-Login it would be URLUtils.url(‘Account-Login’).

105. How can we get the form with name newsletter which is stored under cartridge/forms directory with file name newsletter.xml ?
If we have required server package, it is very simple to do that, just with following code:

var newsletterForm = server.forms.getForm(‘newsletter’)

106. What is the difference between Resourse.msg() and Resource.msgf() methods?
Resource.msg — Returns the message from the specified properties resource bundle.
Resource.msgf — Returns the message from the specified properties resource bundle, with the provided arguments substituted for the message argument placeholders

107. How can we generate csrf token in our controller?
We should require csrf middleware and include it to our controller endpoint middleware (between enpoint name and the endpoint function declaration.

108. How can we declare and set server variables in template? 

There are 2 ways to achieve that:
1) write server script inside the <isscript> tag and use js syntax for variable declaration and setting

2) Use the <isset> ISML tag, which populates the variable with provided data (value and scope)

109. How can we figure out is service mocked or not in code? 

Check the value returned from service.isMock().

110. How can we prevent changes in object?
We should use Object.freeze() method passing the object as parameter.

111. How can we check that new properties can be added to an object?
We should use Object.isExtensible() method passing the object as parameter.

112. How can we get an array of object properties names?
We should use Object.keys() method passing the object as parameter.

113. How can we escape/unescape URI special characters?
We should use decodeURI static method to unascape characters, and encodeURI static method to escape them.

114. How can we hide the part of the page from unregistered customers?
In template, we should add conditional tag <isif> with condition similar to session.customer.isRegistered, and place the markup you want to hide between opening and closing <isif> tags.

115. When can we use Transaction.rollback() method?
We can use that method only if transaction was started with with begin () before

116. What is the best practice to iterate through SFCC objects array? 

Require collections module, which can be found under scripts/util directory

117. Why do we need layout folder in templates directory?

 It is common place to store page decorators.

118. Why do we need <isreplace> tag?
The decorator template uses <isreplace> tag to identify where the decorated content is to be included.

119. What happens if the decorator has multiple <isreplace/> tags?

If the decorator template has multiple <isreplace/> tags, the content to be decorated is included for each <isreplace/> tag.

120. Which class should be used for creating a server instance in SFCC?

Local Service Registry.

121. Which command do we use to upload all cartridges? 

npm run upload Cartridge

122. Which command do we use to create a cartridge with name myCartridge? 

sgmf-scripts — — createCartridge myCartridge

123. Which endpoint do we use to check consent tracking?

 ConsentTracking-Check

124. How can we get http headers from request object? 

req.httpHeaders.get(<header-name>)

125. How can we get site default locale?

 dw.system.Site.getCurrent().defaultLocale.

125. What is the difference between Array.prototype.map() and Array.prototype.forEach()?
The main difference between map and forEach is that the map method returns a new array by applying the callback function on each element of an array, while the forEach method doesn’t return anything.

126. What is the difference between inline, inline-block, and block elements?
The block elements always start on a new line. They will also take space for an entire row or width. List of block elements are <div>, <p>.
Inline elements don’t start on a new line, they appear on the same line as the content and tags beside them. Some examples of inline elements are <a>, <span> ,
<strong>, and <img> tags.
Inline-block elements are similar to inline elements, except they can have padding and margins and set height and width values.

127. Considering the following JavaScript object: let bike = {gears: 10}. Which are valid ways to access its property?
1) Dot property accessor: bike.gears;
2) Square brackets property access: bike[‘gears’]
3) Object destructuring: const { gears } = bike.

128. Which tools Storefront Toolkit provides?
Page Info, Content Info, Search Info, Cache Info, Request Log and Preview Settings.

129. What is CSS opacity?
The technical definition of opacity is the degree to which light is allowed to pass through an object. CSS opacity is the property used to describe the transparency of an element. In other words, it explains how transparent the element is.

130. How can image repetition of the background image be controlled?
background-repeat property controls the repetition of images in the background. Use no-repeat if the image is to be displayed once in the background (background- repeat: no-repeat;).

131. What is Cascading in CSS?
Cascading determines what rules to apply to elements by sizing up the importance of various styling rules that may be in conflict with each other.

132. Is css case-sensitive?
CSS is not case-sensitive, but the URLs of images and font families are case- sensitive. CSS is case-sensitive only for XML declarations with XHTML DOCTYPE on the page.

133. What is the universal selector?
Universal selector (*) is a selector which can match the name of any element type, rather than selecting the elements of a specific category.

134. What are the key features of jQuery?
DOM Manipulation, Event handling, AJAX Support, Animations, Lightweight, Cross Browser Support.

135. What is the difference between $(this) and this in jQuery ?

this and $(this) refer to the same element but the difference is that this is used in a traditional method but with $() it becomes a jQuery object on which we can use the functions of jQuery.

136. What are the three required parameters used for the jQuery Ajax method?
1) URL — You need to specify the URL to send the request;
2) Type — This specifies the type of requests such as Get or Post;
3) Data — It specifies the data to be sent to the server;

137. What is method chaining in jQuery and what are the advantages?
Method chaining is a feature of jQuery that allows several methods to be executed on a jQuery selection in sequence in a single code statement.
For example:
$(‘button#play-movie’) .on(‘click’, playMovie).css(‘background-color’, ‘red’) .show()

138. What is the usage of html() method in jQuery?
The jQuery html() method is used to change the entire content of the selected elements. It replaces the selected element HTML content with new content. Do not muddle with .text() method

139. What must have files to implement page or component types in page designer?
To implement page types and component types, you must include a meta definition file and a script file.

140. Where do we define page-level custom attributes for page designer?
The page-level attributes should be defined in the meta definition file for the page type.

141. How can we optimize page loading time?
There are numerous things accountable for lowering page load time. Let us look at the four best ways to reduce its loading time:
Image Optimization: It is always advised to scale your videos and pictures before uploading them to a page.
Browser Cache: The utilization of cache will boost speed for pages that you have visited already.

Optimize and compress content: Compressing the content of a website decreases the load time of a page to a great extent.
Stylesheet Reference on Top: Setting stylesheet reference to the header of a doc allows your page to load quickly.

142. What is Progressive Rendering?
Progressive rendering is a process that is utilized generally to boost the web page’s rendering content process. Now the rendering process is utilized in modern web development to enhance the mobile data uses of the user, async HTML fragments, prioritizing visible content, and lazy loading of images.

143. Why do we utilize the “use strict”; statement?
The ‘use strict’ statement sets a few restrictions in the script. Typically, it is utilized to facilitate the strict mode of the script, making sure there could be no loose coupling like undeclared variables.

144. Define the Anonymous function in JS?
Generally, the function name is defined when we define the function itself, in normal user-defined functions, but in the case of an anonymous function, the function name is not defined. Here we make use of an assignment operator and variable to stow the function as an object, then utilizing that variable, we will be capable to invoke the function itself.
Example: var multiply = function(a,b){ return a*b ;}

145. Suggest some ways on how to fix the browser-specific styling issue?
We can make a distinctive stylesheet for various browsers making use of server-side rendering.

Another method is utilizing a library such as Bootstrap, which already has the code to manage the browser-specific styling issue.
Reset or Normalize CSS can also be utilized. Multiple 3rd party plugins equip libraries for browser styling issues.

146. What is the difference between attribute and property?

Attributes are an element of an HTML document while properties are a part of the Document Object Model (DOM).
Example: <input type=”text” value=”Tech”>
Here, value and type are the attributes of HTML, but when the statement is read by the browser and parses this code it will make a DOM with different properties, like accept, autofocus, accessKey, baseURI, checked, childElementCount, align, alt, childNodes, children, classList, className, attributes, and clientHeight.
Example:
var data = document.querySelector(input); // here we created a document object of input tag
console.log(input.getAttribute(‘value’)); // tech // getting the attribute value console.log(input.value); // tech // getting the property of the input object

147. Why did we utilize the data- the attribute in HTML and why it is now advised not to use?
Generally, data attributes of HTML are utilized to accumulate the custom data, which is private to the web application or page. This custom data is for personalizing the JavaScript of the user as per the user action on the web page.

These days, data-attributes are not advised to utilize as the user can change the attribute easily just by utilizing the browser inspect console.

148. What is the difference between classical inheritance and prototypal inheritance?
Class Inheritance: instances inherit from classes (like a blueprint — a description of the class), and create sub-class relationships: hierarchical class taxonomies. Instances are typically instantiated via constructor functions with the `new` keyword. Class inheritance may or may not use the `class` keyword from ES6.
Prototypal Inheritance: instances inherit directly from other objects. Instances are typically instantiated via factory functions or `Object.create()`. Instances may be composed from many different objects, allowing for easy selective inheritance.

149. What are pseudo-elements?

Pseudo-elements are keywords that let you specify specific parts of an element instead of the entire thing. For example, you can select an element’s ::first-line or select ::before an element.

150. What is the purpose of OCAPI ?
The Open Commerce API (OCAPI) enables you to access resources using HTTP requests and HTTP responses. Each resource is addressed by its unique URL, which includes the API version. Data is transported using request or header parameters, or within the request body as a JSON document with a defined structure. OCAPI is divided into different APIs: the Shop API allows a client to interact with the system as a shop customer or as an agent shopping on behalf of a customer, the Data API gives create/read/update/delete access to system resources, and the Meta API is used to retrieve a formal description of the Open Commerce API, including custom attributes.

151. What are the key differences between OCAPI requests and storefront-based pipeline or controller requests?
There are several fundamental differences between OCAPI and pipeline / controller- based requests that should be considered by developers when designing an OCAPI strategy for API-first applications:
1) OCAPI requests are not cached by the web-tier, they are cached with a separate cache that is owned by the application-tier — which follows the same cache-clear behavior as the web-tier;
2) OCAPI requests always incur application-tier overhead — regardless of their cache status. Since OCAPI requests are not cached by the web-tier, they always incur the overhead associated with uncached storefront requests;
3) OCAPI documents follow a different caching behavior than storefront requests. Where storefront requests will respect the individual cache TTLs of remote-include content, OCAPI requests that comprise multiple documents will respect the minimum cache TTL of all documents retrieved from the request.

152. Can OCAPI Data API requests be cached by Salesforce B2C Commerce ?
No. Due to the nature of OCAPI Data API requests, they cannot be cached. All Data API requests will incur real-time processing via the application-tier to retrieve the data requested, format it as part of the REST API response, and deliver the response.

153. Can OCAPI Shop API requests be cached by Salesforce B2C Commerce?
Yes. a sub-set of OCAPI Shop API requests can be cached by Salesforce B2C Commerce. Each Shop resource can have its individual cache times configured following the structure of the OCAPI settings document.

154. How many subrequests can contain OCAPI batch request?
An OCAPI batch request can contain up to 50 subrequests. Each subrequest (part) must operate on a single resource; subrequests that specify multiple ids ― for example, ‘/products/(p1,p2…)’ ― are forbidden

155. What are the two properties that can be used to configure cache behavior for Shop API requests?
1) Cache_Time Property (integer).
The cache_time property represents the period in seconds before the cached version of an OCAPI document becomes stale and is re-requested by the Salesforce B2C Commerce platform.
2) Personalized_Caching_Enabled (boolean).
The personalized_caching_enabled flag is used to determine the personalized caching behavior of a cacheable Shop API resource. By default, the Salesforce B2C Commerce platform will cache personalized resources as soon as a customer context (JWT Token) is provided.

156. How are cache keys generated for Shop API responses ?
OCAPI cache keys are similar to storefront page cache keys. They are generated from the following request elements:
– hostname
– siteId
– clientId
– expansion parameters
– custom request URL parameters

157. How does replication affect OCAPI caching?
Replication clears the entire OCAPI cache along with the site cache.

158. How can I clear the OCAPI cache?
To clear the OCAPI cache, invalidate the site page cache. Doing so invalidates both caches, which cannot be cleared separately.
Note: Clearing the page cache can create a heavy load on the application servers. Only clear the page cache manually when necessary, and avoid clearing it during times of high traffic.

159. Are there tools for monitoring OCAPI cache performance?
The platform does not provide direct visibility to the OCAPI cache. The Reports and Dashboards in Business Manager describe cache behavior only for storefront pipeline requests.

160. Which types are supported in OCAPI for input and output of custom properties?

– Text
– String
– Enum of Strings
– Set of Strings
– Integer
– Enum of Integers
– Set of Integers
– Double
– Set of Doubles
– Boolean
– Email
– Password
– Date
– Date+Time.

161. Does OCAPI support the cross-origin resource sharing?

Yes, the Open Commerce API supports the CORS specification.

162. Which OCAPI extension points (hooks) do you know ?
Before, after, and modifyResponse. In addition, some special convenience hooks allow you to perform actions like basket calculations or special checkout steps.

163. Which 4 main characteristics do modifyResponse hook have ?
They support GET, POST, PUT, and PATCH methods to enrich the response document with custom information.
They enable your customization code to change and unset document attributes and add, delete, and change custom attributes in the return document.
They disallow database transactions within your customized script code, making it impossible for your code to change persistent data.
If there is caching, they are only executed if the cache is empty or stale. But they are not executed for every GET or HEAD call.

164. Why do we need Hook Circuit Breaker ?
The Hook Circuit Breaker feature protects the system from excessive Hook script execution failures.

165. Can we use HTML as input value for custom properties in OCAPI?
The value types HTML and Image are only supported as output, but not as input value type for custom properties in OCAPI.

166. Which character encoding is supported by OCAPI?
The Open Commerce API supports character encoding in UTF-8 only.

167. How many locales does SHOP api support? The Shop API supports a single locale at a time

168. How many locales does DATA api support?
The Data API supports multiple locales at the same time.

169. Name the OCAPI feature that allows the API to return data in chunks, instead of returning a complete collection all at once?

It is called OCAPI pagination. Each chunk, depending on its position, links to the previous chunk and to the next chunk

170. What is OCAPI Resource State?
A resource state represents the server-side state of a specific resource e.g. a basket or a customer. It is a string token, baked on all the resource property information.OCAPI exposes resource state information via the _resource_state property in the response payload (body). The response contains either a single resource state or multiple resource states in case calling collection or search resources. In case of body-less responses (e.g. HEAD) the resource state is exposed via x-dw-resource-state response header.

171. What is the usage of OCAPI resource state ?
Resource states provide an OPTIONAL mechanism to implement Optimistic Locking in your client. They can be used to prevent collisions between concurrent requests
e.g. to overcome the “lost update” problem.

172. What is OCAPI session bridge ?
It allows you to obtain a JWT for a session and vice versa without having to re- authenticate the customer

173. How to obtain a JWT for a guest or registered customer?
To obtain a JWT for a guest or registered customer you have to pass a valid dwsid cookie to /customers/auth resource. You have to use “type”: “session”. If you haven’t enabled the global security preference Enforce HTTPS, you must also pass a valid dwsecuretoken in the request. In case of success, you get the JWT back as Authorization:Bearer response header.
To obtain a session for a guest or registered customer you have to pass a valid JWT to /sessions resource. The JWT has to be passed as Authorization:Bearer request header. In case of success you get the session cookies back.

175. What exactly you can do using Customer Service Center?
— Search for orders;
— Create orders, including:
— Adjust prices on individual items, shipping cost, or entire orders;

— Enter coupon code to apply to a new order;
— Specify shipping and billing address;
— Search for products and refine the quantity in an order.
— Search for customers;
— Create customers;
— Create an order for a customer;
— View a customer’s orders;
— View and modify customer data.

176. Are customizable areas localized into languages supported by the Business Manager?
Customizable areas are not localized into languages supported by Business Manager.

177. What parameters are available in the Basket Address data source?

 basket_id and shipment_id.

178. Is it possible to customize Customer Service Center?
You can customize Customer Service Center to modify the behaviour and appearance of its business logic and user interface.
– Business logic, through Shop API hooks. For example, payment processing or hosted payment pages customization
– Areas of the CSC UI by modifying the JSON for those areas in Business Manager.

179. Where in BM you can customize a Customer Service Center customizable area? Administration > Site Development > Customer Service Center Settings.

180. How to return the configuration to the default after applying some area customizations?
To return the configuration to the default, delete the existing configuration and click Save.

181. Which OCAPI API you will use while customizing Customer Service Center? 

Shop API.

182. How does customizable area interact with data resources?

Each customizable area shows data from its default data source. If a customizable area shows (or modifies) data from different resource, that resource must be configured. To show other attributes from other data resources in vies or forms, the element data has to be added as a new top-level element.

183. Is it possible to replicate Customer Service Center UI customizations?
You can replicate Customer Service Center UI customizations to a target system by checking CSC Settings as one of the Replication Tasks.

184. Are multiple locales are supported in a single site in CSC module ?
Customer Service Center doesn’t support different locales in a single site. Product and pricing information display in the default locale.

185. Which order calculation CSC uses for taxes, shipping and promotions ?
Customer Service Center uses the same order calculation routines for pricing, taxes, shipping charges, and promotions as B2C Commerce

186. If you want to set a Storefront path for CSC what should you do first?
You should check/set storefront hostname. A Storefront Path can only be set if a Storefront Hostname is also set.

187. How can you verify address information?
To verify address information, you can use Shop API hooks to access third-party address validation services.

188. How many cart sessions can be assigned to a customer in CSC? 

The customer can have only one active cart session at time.

189. What should you do to notify customer about password change through email in CSC?
In order for the customer password reset to trigger sending the email, a developer in your organization has to implement the After Post hook.

190. What should you do if you want to include country and state/province values in the address form fields on the UI?
All customizable address areas must be updated in Business Manager.

191. Which feature should you use for adding payment integrations in CSC ?

 For payment integrations, use dw.order.hooks.PaymentHooks.

192. How to enable hosted payment pages?
To enable hosted payment pages from Customer Service Center, custom client logic is responsible for rendering the hosted payment page. In addition, you must configure hosted payment pages to use them. You use the hook with either:
dw.csc.hosted_payment_pages.{payment_method_id} 

dw.csc.hosted_payment_pages.{payment_processor_id}

193. Which permissions do you need to create a order in CSC ? 

Orders and CSC permissions in BM roles tab + functional :
• Adjust_Item_Price
• Adjust_Shipping_Price
• Adjust_Order_Price
• Delete_Order_Note
• Create_Order_On_Behalf_Of
• Search_Orders
+ setup at least 1 locale in locale permissions

194. To search for an order, which attributes can you use in CSC?
You can search for an order using order search attributes, such as currency code, coupon codes, order status. When you select the filter icon, the list of order search filters display in a slide-out panel.

195. How can we extend CSC with custom actions?
Customer Service Center supports custom actions with a Business Manager extension cartridge.
A controller represents each action
The cartridge must be added to the BM cartridge path
Every action is secured with a permission in the Customer Service Center permissions tab in the Roles & Permissions view.
Customizable actions can be registered for CSC UI pages:

Customer

Basket 

Order
The actions are registered with a bm_extensions.xml file. 

Every action is represented with a MenuAction of type CSC
The menupath determines the page that the action is assigned. The following menu paths are supported.
customer action is registered for the customer page 

basket action is registered for the basket page 

order action is registered for the order page
All custom actions can be localized.

196. List all customizable areas in CSC.

• Basket View
• Basket Billing Address
• Basket Billing Address View
• Basket Payment Instrument
• Basket Shipping Address
• Customer Address Create
• Customer Address Edit
• Customer Create
• Customer Edit
• Customer Summary
• Order Billing Address View
• Order Payment Instrument
• Order Shipping Address View
• Order Summary
• Price Adjustment

• Product Detail
• Product Search

197. Is it possible to add a Regex for a forms in CSC module ?
Customer Service Center recognizes MetaData Regex configurations for customizable forms. Also, you can overwrite a regex in a particular form configuration.

198. What are customizable grids in CSC?
A customizable grid lets the administrator define how the customer search result appears. Customizable grids consist of columns that define what appears in the particular grid.
The columns contain a title to define the column header manually. If the title is empty, the column header is generated based on the metadata of the attribute defined for that column. If the column contains multiple attributes, the column header remains empty. A layout is defined for each column containing an attribute or an array of attributes which define where the data comes from. Those attributes are resolved against the specific grid data source.

199.What can you modify through UI Customization in CSC ? You can use UI customizations to modify:
• address templates and forms
• price adjustment forms
• payment templates and form