Support » Plugin: Load More Products for WooCommerce » Load More Products and YITH WooCommerce Color and Label Variations Premium

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Dmytro Holovnia

    (@dholovnia)

    Hi @mercerialacostura,

    Please add this code to the After Update textarea to re-init variations labels:

    (function (t) {
        var a = [], e = "";
        var i = function (a, e, i) {
            var s = !1, c = a.data("product_variations"), r = a.find(".variations select"), n = [];
            t.each(r, function () {
                var a = t(this).data("attribute_name") || t(this).attr("name");
                n[a] = i == a ? e : t(this).val()
            });
            for (var o = 0; o < c.length; o++) {
                var l = c[o];
                if (s)break;
                for (var _ in s = l, l.attributes)if (l.attributes.hasOwnProperty(_)) {
                    var d = l.attributes[_];
                    d != n[_] && "" != d && (s = !1)
                }
            }
            return s
        }, s = function (t, a, e) {
            var i = t.find(".variations select");
            1 == i.length && a ? t.trigger("woocommerce_update_variation_values") : i.val(""), i.change(), a || (t.find("div.select_option").removeClass("selected inactive"), t.trigger("reset_data"))
        }, c = function (a, e) {
            var i = t('<span class="yith_wccl_tooltip"></span>'), s = yith_wccl_general.tooltip_pos + " " + yith_wccl_general.tooltip_ani;
            i.addClass(s), a.append(i.html("<span>" + e + "</span>"))
        }, r = function (t) {
            t.toggleClass("selected"), t.siblings().removeClass("selected")
        }, n = function (a) {
            a.preventDefault();
            var e = t(this), i = e.data("product_id"), s = e.data("quantity"), c = [], r = !1;
            a.data.select.each(function (t) {
                c[t] = this.name + "=" + this.value
            });
            try {
                r = "sessionStorage" in window && null !== window.sessionStorage, window.sessionStorage.setItem("wc", "test"), window.sessionStorage.removeItem("wc")
            } catch (t) {
                r = !1
            }
            t.ajax({
                url: yith_wccl_general.ajaxurl.toString().replace("%%endpoint%%", "yith_wccl_add_to_cart"),
                type: "POST",
                data: {
                    action: "yith_wccl_add_to_cart",
                    product_id: i,
                    variation_id: a.data.variation,
                    attr: c.join("&"),
                    quantity: s,
                    context: "frontend"
                },
                beforeSend: function () {
                    e.addClass("loading").removeClass("added")
                },
                success: function (a) {
                    a.error && a.product_url ? window.location = a.product_url : yith_wccl_general.cart_redirect ? window.location = yith_wccl_general.cart_url : (e.removeClass("loading").addClass("added"), e.next(".added_to_cart").length || e.after(' <a href="' + yith_wccl_general.cart_url + '" class="added_to_cart wc-forward" title="' + yith_wccl_general.view_cart + '">' + yith_wccl_general.view_cart + "</a>"), a.fragments && t.each(a.fragments, function (a, e) {
                        t(a).replaceWith(e)
                    }), r && (sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(a.fragments)), sessionStorage.setItem("wc_cart_hash", a.cart_hash)), t(document).trigger("wc_update_cart"), t(document.body).trigger("added_to_cart", [a.fragments, a.cart_hash, e]))
                }
            })
        };
        t.yith_wccl(a), t(document).on("yith-wcan-ajax-filtered yith_infs_adding_elem initialized.owl.carousel post-load ajax-tab-loaded", function () {
            void 0 !== t.yith_wccl && void 0 !== t.fn.wc_variation_form && (t(document).find(".variations_form:not(.initialized), .owl-item.cloned .variations_form").each(function () {
                t(this).wc_variation_form()
            }), t.yith_wccl(a))
        }), t("body").on("quick-view-displayed", function () {
            var a = t(".pp_woocommerce_quick_view").find(".yith-wccl-data").data("attr");
            a && t.yith_wccl(a)
        });
    })(jQuery);
    

    Regards,
    Dima

    Thread Starter mercerialacostura

    (@mercerialacostura)

    Hey Dima,

    Thank you so much for your quick response.

    I did what you said, but it didn’t work. It seems there’s something wrong, here you have: http://nimb.ws/AQ2B0Y

    Let me know!

    Thanks

    Plugin Author Dmytro Holovnia

    (@dholovnia)

    OK,

    Replace please all that code with this line
    jQuery(document).trigger('yith_infs_adding_elem');

    Regards,
    Dima

    Thread Starter mercerialacostura

    (@mercerialacostura)

    I’m sorry, but with this line I have the same notification error: http://nimb.ws/AQ2B0Y

    Plugin Author Dmytro Holovnia

    (@dholovnia)

    Hi @mercerialacostura,

    Could you please add it again and leave it there for now. I will check why it is providing a message. This message is only for admins. Your clients will not see it.

    Regards,
    Dima

    Thread Starter mercerialacostura

    (@mercerialacostura)

    Sure @dholovnia! It’s done, you can check it know.

    Thanks!

    Plugin Author Dmytro Holovnia

    (@dholovnia)

    @mercerialacostura,

    I see the code as jQuery(document).trigger(& #039;yith_infs_adding_elem& #039;);
    while it should be jQuery(document).trigger('yith_infs_adding_elem');
    try to use this one jQuery(document).trigger("yith_infs_adding_elem");

    Regards,
    Dima

    Thread Starter mercerialacostura

    (@mercerialacostura)

    Hey @dholovnia,

    It worked! I used the last option, with double quotes (“):
    jQuery(document).trigger("yith_infs_adding_elem");

    Thank you so much for your help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Load More Products and YITH WooCommerce Color and Label Variations Premium’ is closed to new replies.