Shopify Menu customisation....

Topic summary

Original Question:
UboraGroup wants to convert Shopify Search & Discovery metafield-powered filter menus from long lists into dropdown selector boxes, similar to how the price filter displays as a slider. They have three metafields per product that could generate hundreds of menu items, and need a more compact display format.

Key Clarification:
The menu already exists and is automatically populated by Search & Discovery using custom metafields on collection pages. UboraGroup specifically needs to modify how these filters render (dropdown vs. list), not create new navigation HTML or CSS styling.

Proposed Solution:

  • Locate the existing price slider code in theme JavaScript files (theme.js or filters.js) to understand how Search & Discovery controls filter display types
  • Use JavaScript to override default rendering behavior by transforming filter list elements into <select> dropdowns
  • Ensure dropdowns trigger AJAX-based product filtering without page reloads
  • Target specific filter containers and replace list items with dropdown options while maintaining Search & Discovery’s filtering functionality

Side Discussion:
JesseSuarez asked about displaying live inventory status (“In Stock” vs “Made to Order”) directly in product variant dropdowns without requiring selection. Rajweb provided code snippet for main-product.liquid, though implementation details are being refined via direct message.

Status: Main question remains open; UboraGroup needs to identify the slider code to replicate dropdown behavior for their metafield filters.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

I think it’s possible to alter the menu system a lot on a store front by using CSS…

Is there a way to code a menu to come up as a selector box instead if a long list of options. This is for a Search & Discovery powered menu, I’ve got 3 metafields per product however these are options that will go into the hundreds, which I don’t mind but I don’t need hundreds of menu items to display at the same, a drop down would shorten it a lot and a customer can select 1 item from each menu using the drop down and each menu filters the other menus down based on any of the selections of the other 2, in any order.

Hey @UboraGroup ,

Yes, you can definitely achieve a dynamic and interactive menu system using CSS, JavaScript, and Shopify’s metafields to create a dropdown menu for your Search & Discovery-powered navigation. This approach will help manage long lists of options while allowing customers to filter products based on their selections from the dropdown menus.

  1. HTML Structure for the Dropdown Menus:

You can create dropdowns for each category (based on your metafields), and use JavaScript to filter the other dropdowns based on the selection. Here’s an example structure:


  

  

  

  1. Populating the Dropdowns Dynamically:

You can use Shopify’s Liquid templating language to pull the values from the product metafields and create the options dynamically. Here’s a simplified example of how to populate the dropdowns with metafield data:

{% assign metafield1_values = product.metafields.custom.filter_1 %}
{% assign metafield2_values = product.metafields.custom.filter_2 %}
{% assign metafield3_values = product.metafields.custom.filter_3 %}

  1. JavaScript for Filtering Selections:

Now, you’ll need some JavaScript to dynamically filter the dropdowns based on the user’s selections. Here’s an approach where each dropdown is filtered based on previous selections:

document.addEventListener("DOMContentLoaded", function() {
  const filter1 = document.getElementById("filter1");
  const filter2 = document.getElementById("filter2");
  const filter3 = document.getElementById("filter3");

  // Function to filter options in dropdowns based on previous selections
  function filterOptions() {
    // Get selected values from the filters
    const selected1 = filter1.value;
    const selected2 = filter2.value;
    const selected3 = filter3.value;

    // Filter logic based on selected values
    // Update options of filter2 based on filter1, and filter3 based on filter2, etc.
    // For simplicity, assuming you have pre-defined data for filtering
    const data = {
      filter1: ["Option 1", "Option 2", "Option 3"],
      filter2: {
        "Option 1": ["Sub-option 1a", "Sub-option 1b"],
        "Option 2": ["Sub-option 2a", "Sub-option 2b"],
      },
      filter3: {
        "Sub-option 1a": ["Sub-sub-option 1aa", "Sub-sub-option 1ab"],
        "Sub-option 2a": ["Sub-sub-option 2aa", "Sub-sub-option 2ab"],
      },
    };

    // Update filter2 options based on filter1 selection
    const options2 = data.filter2[selected1] || [];
    filter2.innerHTML = '';
    options2.forEach(option => {
      const optionElement = document.createElement("option");
      optionElement.value = option;
      optionElement.textContent = option;
      filter2.appendChild(optionElement);
    });

    // Update filter3 options based on filter2 selection
    const options3 = data.filter3[selected2] || [];
    filter3.innerHTML = '';
    options3.forEach(option => {
      const optionElement = document.createElement("option");
      optionElement.value = option;
      optionElement.textContent = option;
      filter3.appendChild(optionElement);
    });
  }

  // Add event listeners to trigger filtering
  filter1.addEventListener("change", filterOptions);
  filter2.addEventListener("change", filterOptions);
  filter3.addEventListener("change", filterOptions);

  // Initial filter load
  filterOptions();
});
  1. CSS for Styling:

To style the dropdowns and the overall look of your menu, you can add some CSS to make the interface clean and user-friendly:

#filter1, #filter2, #filter3 {
  width: 200px;
  padding: 10px;
  margin: 10px 0;
  border-radius: 4px;
  border: 1px solid #ddd;
  background-color: #fff;
}

#filter1, #filter2, #filter3 {
  display: inline-block;
}

This method allows you to simplify your menu system significantly by using dropdowns instead of showing hundreds of options at once. The selections can be dynamically filtered based on what the customer chooses, making for a more intuitive and interactive shopping experience.

Let me know if you need any further clarification or help with the implementation!

If I was able to help you, please don’t forget to Like and mark it as the Solution!
If you’re looking for expert help with customization or coding, I’d be delighted to support you. Please don’t hesitate to reach out via the email in my signature below—I’m here to help bring your vision to life!

Best Regard,
Rajat Sharma

Hi,

I probably need to be more specific, a menu already exists, powered by Shopify Search & Discovery, it is auto-matically populated using Metafield data held in each product using a custom metafield. These are assigned to the collection pages. On the lefthand side appears a navigation menu, starting with the main menu set by Shopify default which are the main parent categories set by shopify, modified to my store, so for example you’d have clothes, books, electronics etc.

below this is search and discovery navigation which is set by search and discovery, not the normal shopify navigation. This includes by default, brand, product type, price etc, now i’ve added categories to this, which is where as mentioned above the navigation grows because lets say the price menu display items at £1, £2, £3 all the way to a million there would be a huge navigation menu reaching to china.

Instead of this, the price portion has a slider, what dictates that this part of the menu is a slider of prices, rather than a list? That is what I want to do to my menu, but instead of a slider I want it to dictate these metafield options are in a drop down box, rather than a list, but as it is a search and discovery powered menu I can’t make alterations to the normal navigation.

I don’t need menu html, the menu already exists and is live in the store, and I don’t need CSS as the CSS style is already dictated in the shopify template, I just want those 3 portions of the search and discovery metafield powered menu to come up as a selector box instead of a list. I will try to track down where in the code that the price field is dictated to be a slider as this must be where the code dictates how a menu is displayed and functions for the search and discovery powered fields.

@UboraGroup ,

Ah, I see! You’re working with the Search & Discovery app, and you want to change the behavior of the metafield-powered filters so they show as a dropdown selector instead of a long list, similar to how the price filter is displayed as a slider.

Since Search & Discovery is managed via Shopify’s dynamic filtering system and doesn’t allow direct customizations of its interface via the theme, achieving this effect may require overriding the default rendering behavior of these filters using JavaScript.

Here’s how you can approach it:

  1. Identify the Price Slider Code:

As you mentioned, the price filter is already displayed as a slider. The feature that controls this might be part of the Shopify Search & Discovery app or a custom script that is applied to the price range filter:

To adjust the other metafield filters in a similar manner, you’ll need to identify the script that handles the price slider.

-Check your theme’s JavaScript files, especially in theme.js or filters.js. Look for code related to the price slider, likely involving an input range (e.g., )and an event listener for filtering.

-Look for sections like:

const priceSlider = document.querySelector('.price-slider');
// Code for price slider interactions

Once you locate this section, you can base your custom dropdown functionality on it.

  1. Transform Other Filters into Dropdowns:

You will need to use JavaScript to manipulate the HTML of the filters, turning the long lists of options (e.g., brands, categories, etc.) into dropdowns instead of checkboxes or list items.

Here’s an outline of what needs to happen:

-Step 1: Target the filter containers for your metafield-powered options. These are likely rendered in a ul or div format with list items.

-Step 2: Replace those elements with

Hey! Love your answer, so detailed!
may be you also could help me with my question.
i need to show inventory visible live in dropdown product menu for client like on screenshot

half of products options are ready to order and some all “make to order”, but all are available and i need to show what option is what without choosing it. Is it possible to make ?

Hey @JesseSuarez ,

Yes, We’ve updated the product dropdown to display live inventory status. Customers can now see whether a product is “In Stock” or “Made to Order” without selecting it.

Here’s the code we implemented:


Let me know if you need any adjustments!

If I was able to help you, please don’t forget to Like.

If you’re looking for expert help with customization or coding, I’d be delighted to support you. Please don’t hesitate to reach out in my signature below—I’m here to help bring your vision to life!

Best,

Rajat

Rajweb, thank you for your answer
Could you please leet me know where exactly i need to paste this code?
Main-product.liquid?

I’ve paste this code to main-product.liquid and it works, but new field appear (you could see result in 1st screenshot). But what i need is on 2nd screenshot. Is it possible to make it?

@JesseSuarez

I understand your concern! Could you please DM me using the contact details in my signature? That way, I can assist you more effectively and guide you step by step to achieve the exact result you’re looking for. Thanks!