Home Forums WoodMart support forum trigger('woodmart-quick-view-displayed') is not being called in a proper timing

trigger('woodmart-quick-view-displayed') is not being called in a proper timing

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #229129

    urbanaatelie
    Participant

    Hi XTemos team!!

    I’m trying to use one of your custom triggers on Quick Shopping, but it’s not properly timed in the theme code. Please see below…

    On this file:
    wp-content\themes\woodmart\js\functions.js

    Function:
    woodmartThemeModule.quickShop

    There is a custom trigger that you guys implemented called:
    woodmart-quick-view-displayed

    That is really helpful and thank you for that!!
    However, I think it needs some minor tweaks to work as it supposed to…

    1- when the quick shop is already loaded and the ajax call is not needed, it also needs to trigger the event to let the observers know the quick shop is displayed.

    Current:

    
    if ($product.hasClass('quick-shop-loaded')) {
      $product.addClass('quick-shop-shown');
      return;
    }
    

    Needs to be:

    
    if ($product.hasClass('quick-shop-loaded')) {
      $product.addClass('quick-shop-shown');
      $('body').trigger('woodmart-quick-view-displayed');
      return;
    }
    

    2- the event needs to be triggered when the quick shop is effectively open.

    Current:

    
    success: function (data) {
      // insert variations form
      $content.append(data);
    
      initVariationForm($product);
      $('body').trigger('woodmart-quick-view-displayed');
      woodmartThemeModule.swatchesVariations();
      woodmartThemeModule.btnsToolTips();
    },
    complete: function () {
      setTimeout(function () {
        $this.removeClass(loadingClass);
        $product.removeClass('wd-loading-quick-shop');
        $product.addClass('quick-shop-shown quick-shop-loaded');
      }, 100);
    },
    

    Needs to be:

    
    success: function (data) {
      // insert variations form
      $content.append(data);
    
      initVariationForm($product);
      woodmartThemeModule.swatchesVariations();
      woodmartThemeModule.btnsToolTips();
    },
    complete: function () {
      setTimeout(function () {
        $this.removeClass(loadingClass);
        $product.removeClass('wd-loading-quick-shop');
        $product.addClass('quick-shop-shown quick-shop-loaded');
        $('body').trigger('woodmart-quick-view-displayed');  //moved to here
      }, 100);
    },
    

    Please let me know if that makes sense.
    It would be REALLY helpful for customization on this flow.

    Would that be possible to have this fix on a next release please?

    kind regards,
    Wil

    #229245

    Artem Temos
    Keymaster

    Hello,

    Thank you for your suggestions. We will review this for our future updates.

    Kind Regards

    #229443

    urbanaatelie
    Participant

    Thanks a lot!
    I know it seems like a minor thing, but it’s just a couple of lines that will make a whole lot of difference for those who need this event working as expected.
    I’m crossing my fingers to have it fixed in the next theme update!

    Cheers! o/

    #229471

    Artem Temos
    Keymaster

    We will review this for sure.

    Kind Regards

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘trigger('woodmart-quick-view-displayed') is not being called in a proper timing’ is closed to new replies.