0

I am building the Woocommerce/Bootstrap site and I need help with something. Currently checkout form is divided into three tabs and in last tab before final payment customer wants to give one last chance for buyers to change their minds.

The problem is that if buyer decide to update cart with additional product quantity the page gets refreshed and form gets beck to first tab.

I am using this function but it is not working...

    var hash = location.hash
    , hashPieces = hash.split('?')
    , activeTab = $('[href=' + hashPieces[0] + ']');
    activeTab && activeTab.tab('show');

This is apparently code provided from someone that participated in the framework creation but it is not working for me. Is there maybe a way to update the cart without refreshing the page. For anyone who would like to help me the url is

    http://176.9.5.243/~divesdes/shop

I have also tried to do it with jquery Tabs plugin and it works fine using

    $(".tabs").tabs({
    select: function(event, ui) {                   
    window.location.replace(ui.tab.hash);
    },
    });

but only when the page is manually refreshed and updating the cart also displays first tab on page reload.

Help would be much appreciated.

Thanks

strivedi183
  • 4,749
  • 2
  • 31
  • 38
user2186701
  • 31
  • 1
  • 7

1 Answers1

0

Twitter Bootstrap Tabs: Go to Specific Tab on Page Reload or Hyperlink

// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
    $('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ;
} 

// Change hash for page-reload
$('.nav-tabs a').on('shown', function (e) {
    window.location.hash = e.target.hash;
})

the above may help.

Community
  • 1
  • 1
eterwei
  • 1
  • 2