When my product page loads the first tab is active:


How do I get the 2nd tab to be active on page load, so it looks like this?



You will need to create three files:

1 app/design/frontend/namespace/themename/requirejs-config.js

var config = {
    map: {
        '*': {
            opentab: 'js/opentab'

2 app/design/frontend/namespace/themename/web/js/opentab.js

Change name to the tab name you want to open on page load

define(['jquery'], function($){
   "use strict";
       return function opentab()

            $(document).ajaxComplete(function() {

3 app/design/frontend/namespace/themename/Magento_Category/templates/product

<script type="text/javascript">
    require(['jquery', 'opentab'], function($, opentab) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.