With the code below, I'm hiding a product option from a Shopify app. I need to narrow down the CSS selector to a data-option-id attribute so that only that product option is hidden in case I add another option to the page.
{% if template contains "product" and product.handle == "copy-2-add-a-custom-logo" %}
if (getCookie(customLogoCookie) == "1") {
let myInterval = setInterval(function() {
const customLogoOptionSetId = "gsAppContainer"; // Fixed id
let customLogoSelector = document.getElementById(customLogoOptionSetId);
if (!customLogoSelector) {
return;
}
clearInterval(myInterval);
// Hide the custom options. We need to go 3 levels up.
customLogoSelector.style.display = "none";