File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -214,16 +214,15 @@ define([
214214 * Clears the active state if no valid category URL is found or if it's not a product page.
215215 *
216216 * @param {String } currentUrl - The current page URL without parameters.
217- * @return { Boolean } - True if a valid category is set, false otherwise.
217+ * @return void
218218 * @private
219219 */
220220 _setActiveMenuForProduct : function ( currentUrl ) {
221221 var firstCategoryUrl = this . element . find ( '> li a' ) . attr ( 'href' ) ;
222222
223- // Return false if no category URL is found in the menu.
224223 if ( ! firstCategoryUrl ) {
225224 this . _clearActiveState ( ) ;
226- return false ;
225+ return ;
227226 }
228227
229228 var categoryUrlExtension = this . _getUrlExtension ( firstCategoryUrl ) ;
@@ -233,22 +232,16 @@ define([
233232 if ( isProductPage ) {
234233 var currentHostname = window . location . hostname ;
235234
236- // Check if the referrer's hostname matches the current hostname
237- // and if the referrer's pathname ends with the category URL extension
238235 if ( document . referrer . includes ( currentHostname ) && document . referrer . endsWith ( categoryUrlExtension ) ) {
239236 categoryUrl = document . referrer . split ( '?' ) [ 0 ] ;
240237 } else {
241- // Fallback to using the current URL
242238 categoryUrl = currentUrl . substring ( 0 , currentUrl . lastIndexOf ( '/' ) ) + categoryUrlExtension ;
243239 }
244240
245241 this . _setActiveMenuForCategory ( categoryUrl ) ;
246- return true ;
242+ } else {
243+ this . _clearActiveState ( ) ;
247244 }
248-
249- // Clear active state if not a product page
250- this . _clearActiveState ( ) ;
251- return false ;
252245 } ,
253246
254247 /**
You can’t perform that action at this time.
0 commit comments