Issues with the use of Custom Script Referencing jQuery in My Account Page of Site Builder

When NetSuite upgrades a jQuery library that will be applied to all environments including the webstore, there is a chance that it might conflict with the current jQuery scripts that the customer is using in their webstore.

When a shopper is not able to finish a transaction in the My Account Page of a Site Builder Web Store and the error is related to the scripts that are referencing a custom jQuery code, the cause might be:

  • There is an incompatibility issue between the new version and what their current script does with jQuery, or 
  • They are explicitly loading the old version of jQuery and there’s a collision with the new jQuery version. This manifests in various ways, but typically preventing a page from completely loading or disabling some user interface elements on the page

NetSuite supports loading/referencing 3rd party libraries like jQuery in SuiteScript. However as best practice, the script author should namespace the library in their script to avoid some kind of collision.

Solution

1. Identify the jQuery code that the user is currently using and where it its located.

a.  Navigate to Commerce > Site Builder > Themes
b. Edit the Theme that the user is currently using on their web store.
c.  Check all the jQuery scripts under Theme Addition to <head> section
d.  paste the code in a text editor Note: Make sure all other jQuery code will be removed from the Addition to <head> and are pasted in a text editor for reference.


2. Create a new custom tag.

a. Navigate to Commerce > Site Builder > Tags > New.
b. Enter the Name THEMEJQUERY in the Tag field.
c. Enter the code from step 1.d to the Default value field.
d. Click Save.


3. Input custom tag in webstore setup

a. Navigate to Commerce > Site Builder > Themes 
b. Edit the Theme that the user is currently using on their web store.
c. In the Addition to <head> field add the custom tag that the user just created (1st line of the editor). The custom tag should look like <THEMEJQUERY>


4. Remove the default value in the MyAccount Page only by following these steps:

a. Navigate to Commerce > Site Builder > Tabs.
b. Edit the My Account tab
c. Go to the Tag Substitution subtab
d. select the THEMEJQUERY tag from the drop down list.
e. Enter a space or the characters &nbsp or &nbsp; in the Substitution Value column.
f. Click Add
g. Click Save.

Leave a comment

Your email address will not be published. Required fields are marked *