auto close collapsible section row

auto close collapsible section row

SinghSells
Excursionist
21 0 6

can you please tell me how to auto close collapsible section for related product? picture attached for better understanding.

everything is under collapsible row and auto close except related products collapsible.

product page link 

 

 

auto close collasible.PNG

Replies 4 (4)

BSSCommerce-B2B
Shopify Partner
1954 562 561

@SinghSells,

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above </body>

 

{% if template.name == 'product' %}
  <script>
    document.addEventListener("DOMContentLoaded", function() {
      const summaryElement = document.querySelector("product-recommendations summary");
      if (summaryElement) {
        summaryElement.click();
      }
    });
  </script>
{% endif %}

 

Hope it helps you 🙂

B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.


B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.


B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.


BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now

SinghSells
Excursionist
21 0 6

didn't worked sorry. 

I hope it's before </body> not <head> ?

 

BSSCommerce-B2B
Shopify Partner
1954 562 561

@SinghSells, yes before </body>, try again I've just updated the code 🙂

B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.


B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.


B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.


BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now

BSSCommerce-B2B
Shopify Partner
1954 562 561

@SinghSells, if it still didn't work try this one

 {% if template.name == 'product' %}
    <script>
      document.addEventListener("DOMContentLoaded", function() {
        let interval;
        interval = setInterval(()=>{
          const summaryElement = document.querySelector("product-recommendations summary");
          if (summaryElement) {
            summaryElement.click();
          }
        },200)
        setTimeout(()=>{clearInterval(interval)},3000)
      });
    </script>
  {% endif %}

B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.


B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.


B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.


BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now