Plugin Directory

Changeset 2794873


Ignore:
Timestamp:
10/06/2022 06:56:56 AM (3 years ago)
Author:
tribeinteractive
Message:

Plugin updated to version 1.9.5

Location:
caddy
Files:
87 added
6 edited

Legend:

Unmodified
Added
Removed
  • caddy/trunk/README.txt

    r2783261 r2794873  
    77Tested up to: 6.0.2
    88Requires PHP: 7.0
    9 Stable tag: v1.9.4
     9Stable tag: v1.9.5
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    112112
    113113== Changelog ==
     114
     115= 1.9.5 =
     116* Fix: trash button is not working for some customers
     117* Improvement: Tested upto latest WooCommerce 6.9.4 and WordPress 6.0.2 versions
    114118
    115119= 1.9.4 =
  • caddy/trunk/caddy.php

    r2783261 r2794873  
    44 * Plugin URI:        https://usecaddy.com
    55 * Description:       A high performance, conversion-boosting side cart for your WooCommerce store that improves the shopping experience & helps grow your sales.
    6  * Version:           1.9.4
     6 * Version:           1.9.5
    77 * Author:            Tribe Interactive
    88 * Author URI:        https://www.madebytribe.com
     
    1212 * Domain Path:       /languages
    1313 *
    14  * WC requires at least: 3.0
    15  * WC tested up to: 6.8.2
     14 * WC requires at least: 4.0
     15 * WC tested up to: 6.9.4
    1616 */
    1717
     
    2525 */
    2626if ( ! defined( 'CADDY_VERSION' ) ) {
    27     define( 'CADDY_VERSION', '1.9.4' );
     27    define( 'CADDY_VERSION', '1.9.5' );
    2828}
    2929if ( ! defined( 'CADDY_PLUGIN_FILE' ) ) {
  • caddy/trunk/includes/class-caddy.php

    r2760126 r2794873  
    263263        $this->loader->add_action( 'wc_ajax_nopriv_cc_add_to_cart', $caddy_public_obj, 'caddy_add_to_cart' );
    264264
     265        // Add action for remove product from the cart
     266        $this->loader->add_action( 'wc_ajax_cc_remove_item_from_cart', $caddy_public_obj, 'caddy_remove_item_from_cart' );
     267        $this->loader->add_action( 'wc_ajax_nopriv_cc_remove_item_from_cart', $caddy_public_obj, 'caddy_remove_item_from_cart' );
     268
    265269        // Add action for update quantity for cart item
    266270        $this->loader->add_action( 'wc_ajax_cc_quantity_update', $caddy_public_obj, 'caddy_cart_item_quantity_update' );
  • caddy/trunk/public/class-caddy-public.php

    r2768193 r2794873  
    269269    public function get_refreshed_fragments() {
    270270        WC_AJAX::get_refreshed_fragments();
     271    }
     272
     273    /**
     274     * Remove product from the cart
     275     */
     276    public function caddy_remove_item_from_cart() {
     277        //Check nonce
     278        if ( is_user_logged_in() ) {
     279            $condition = ( wp_verify_nonce( $_POST['nonce'], 'caddy' ) && isset( $_POST['cart_item_key'] ) );
     280        } else {
     281            $condition = ( isset( $_POST['cart_item_key'] ) );
     282        }
     283
     284        if ( $condition ) {
     285            $cart_item_key = wc_clean( isset( $_POST['cart_item_key'] ) ? wp_unslash( $_POST['cart_item_key'] ) : '' );
     286            if ( ! empty( $cart_item_key ) ) {
     287                WC()->cart->remove_cart_item( $cart_item_key );
     288            }
     289            $this->get_refreshed_fragments();
     290        }
     291        wp_die();
    271292    }
    272293
  • caddy/trunk/public/js/caddy-public.js

    r2783261 r2794873  
    7373            $( '.cc-compass' ).toggleClass( 'cc-compass-open' );
    7474            $( 'body' ).toggleClass( 'cc-window-open' );
     75        } );
     76
     77        // Remove cart item
     78        $( document ).on( 'click', '.cc-cart-product-list .cc-cart-product a.remove_from_cart_button', function() {
     79            var button = $( this );
     80            remove_item_from_cart( button );
    7581        } );
    7682
     
    478484    }
    479485
     486    /* Remove item from the cart */
     487    function remove_item_from_cart( button ) {
     488        var cartItemKey = button.data( 'cart_item_key' ),
     489            productName = button.data( 'product_name' ),
     490            product_id = button.data( 'product_id' );
     491
     492        // AJAX Request for remove product from the cart
     493        var data = {
     494            nonce: cc_ajax_script.nonce,
     495            cart_item_key: cartItemKey
     496        };
     497        $.ajax( {
     498            type: 'post',
     499            url: cc_ajax_script.wc_ajax_url.toString().replace( '%%endpoint%%', 'cc_remove_item_from_cart' ),
     500            data: data,
     501            complete: function( response ) {
     502                // Remove "added" class after deleting the item from the cart
     503                if ( ($( '.single_add_to_cart_button, .add_to_cart_button' ).length > 0) ) {
     504                    $( '.single_add_to_cart_button.added, .add_to_cart_button.added' ).each( function() {
     505                        if ( $( 'form.cart' ).length > 0 && !$( this ).hasClass( 'add_to_cart_button' ) ) {
     506                            var $form = $( this ).closest( 'form.cart' ),
     507                                atc_product_id = $form.find( 'input[name=add-to-cart]' ).val() || $( this ).val(),
     508                                atc_variation_id = $form.find( 'input[name=variation_id]' ).val() || 0;
     509                            if ( atc_variation_id !== 0 ) {
     510                                atc_product_id = atc_variation_id;
     511                            }
     512                        } else {
     513                            var atc_product_id = $( this ).data( 'product_id' );
     514                        }
     515                        if ( atc_product_id == product_id ) {
     516                            if ( $( this ).hasClass( 'added' ) ) {
     517                                $( this ).removeClass( 'added' );
     518                            }
     519                        }
     520                    } );
     521                }
     522            },
     523            success: function( response ) {
     524                var fragments = response.fragments;
     525                // Replace fragments
     526                if ( fragments ) {
     527                    $.each( fragments, function( key, value ) {
     528                        $( key ).replaceWith( value );
     529                    } );
     530                }
     531
     532                // Activate tabby cart tab
     533                var tabs = new Tabby( '[data-tabs]' );
     534                tabs.toggle( '#cc-cart' );
     535            }
     536        } );
     537    }
     538
    480539    /* Remove item from save for later */
    481540    function remove_item_from_save_for_later( button ) {
  • caddy/trunk/public/js/caddy-public.min.js

    r2760126 r2794873  
    1 !function(c){"use strict";var t=c(".cc-window");function a(t=""){c.ajax({type:"post",url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(a){var e=a.fragments;if(e&&c.each(e,(function(t,a){c(t).replaceWith(a)})),new Tabby("[data-tabs]").toggle("#cc-cart"),"yes"==t&&c(".cc-window-wrapper").hide(),"move_to_cart"===t&&(c(".cc_cart_from_sfl").removeClass("cc_hide_btn"),c(".cc_cart_from_sfl").parent().find(".cc-loader").hide(),c(".cc-coupon .woocommerce-notices-wrapper").remove(),c(".cc-cart").removeAttr("hidden")),"no"===a.flatsome_product_redirect)return!1}})}jQuery(document).ready((function(c){setTimeout((function(){a()}),200),c(".cc-nav ul li a").mousedown((function(){c(this).addClass("using-mouse")})),c("body").keydown((function(){c(".cc-nav ul li a").removeClass("using-mouse")}));var e=new Tabby("[data-tabs]");c(document).mouseup((function(a){var e=c(".cc-window.visible, .cc-compass, #toast-container");e.is(a.target)||0!==e.has(a.target).length||t.hasClass("visible")&&(c(".cc-compass").toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open"),c(".cc-overlay").hide(),t.animate({right:"-1000px"},"slow").removeClass("visible"),c("#toast-container").length>0&&c("#toast-container").animate({right:"25px"},"fast").toggleClass("cc-toast-open"))})),c(document).on("click",".cc-compass",(function(){c(this).toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open"),t.hasClass("visible")?(c(".cc-overlay").hide(),t.animate({right:"-1000px"},"slow").removeClass("visible")):(c(".cc-overlay").show(),e.toggle("#cc-cart"),t.animate({right:"0"},"slow").addClass("visible"))})),c(document).on("click",".ccicon-x",(function(){c(".cc-overlay").hide(),t.animate({right:"-1000px"},"slow").removeClass("visible"),c(".cc-compass").toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open")})),c(document).on("click","a.remove_from_sfl_button",(function(){i(c(this))})),c("body").on("added_to_cart",(function(a,e,o,n){var s=c(".cc-compass-desk-notice").val(),i=c(".cc-compass-mobile-notice").val();cc_ajax_script.is_mobile&&!t.hasClass("visible")&&"mob_disable_notices"===i?setTimeout((function(){c(".cc-compass").trigger("click")}),20):cc_ajax_script.is_mobile||t.hasClass("visible")||"desk_disable_notices"!==s&&"desk_notices_caddy_window"!==s&&""!==s||setTimeout((function(){c(".cc-compass").trigger("click")}),20)})),c(document).on("click",".single_add_to_cart_button",(function(t){if(t.preventDefault(),!c(this).hasClass("disabled")){if(!(c(this).hasClass("product_type_variable")||c(this).hasClass("product_type_bundle")||c(this).hasClass("product_type_external"))){var e=c(this),o=e.closest("form.cart").serializeArray(),n=!1;if(c.each(o,(function(c,t){if(("productID"===t.name||"add-to-cart"===t.name)&&t.value)return n=!0,!1})),!n)var s=c(this).data("product_id");if(e.attr("name")&&"add-to-cart"==e.attr("name")&&e.attr("value"))s=e.attr("value");return s&&o.push({name:"add-to-cart",value:s}),o.push({name:"action",value:"cc_add_to_cart"}),c(document.body).trigger("adding_to_cart",[e,o]),c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_add_to_cart"),data:c.param(o),beforeSend:function(t){c("#cc-cart").css("opacity","0.3"),c(".cc-compass").find(".licon").hide(),c(".cc-compass").find(".cc-loader").show(),c("form.cart").length>0&&e.removeClass("added").addClass("loading")},success:function(t){t.error&&t.product_url?window.location.reload():e.hasClass("add_to_cart_button")||(a(),c(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,e]))},complete:function(t){c(".cc-compass").find(".cc-loader").hide(),c(".cc-compass").find(".licon").show(),c("form.cart").length>0&&e.addClass("added").removeClass("loading"),c("#cc-cart").css("opacity","1")}}),!1}var i=c(this).attr("href");window.location=i}})),c(document).on("click",".cc-pl-info .cc-pl-actions .cc-view-cart",(function(){e.toggle("#cc-cart")})),c(document).on("click",".cc_item_quantity_update",(function(){o(c(this))})),c(document).on("click",".save_for_later_btn",(function(){n(c(this))})),c(document).on("click",".cc_cart_from_sfl",(function(){s(c(this))})),c(document).on("click",".cc_back_to_cart",(function(){r()})),c(document).on("click",".added_to_cart.wc-forward, .woocommerce-error .button.wc-forward",(function(c){c.preventDefault(),l()})),c(document).on("click",".cc_saved_items_list",(function(){d()})),c(document).on("click",".cc_cart_items_list",(function(){l()})),c(document).on("click",".cc-view-saved-items",(function(){new Tabby("[data-tabs]").toggle("#cc-saves")})),c(".variations_form").length>0&&(c(".cc_add_product_to_sfl").addClass("disabled"),c(this).each((function(){c(this).on("found_variation",(function(t,a){c(".cc_add_product_to_sfl").removeClass("disabled")})),c(this).on("reset_data",(function(){c(".cc_add_product_to_sfl").addClass("disabled")}))}))),c(document).on("submit","#apply_coupon_form",(function(c){c.preventDefault(),_()})),c(document).on("click",".cc-applied-coupon .cc-remove-coupon",(function(){u(c(this))})),c(document).on("click",".cc-nav ul li a",(function(){"cc-cart"===c(this).attr("data-id")&&c(".cc-pl-upsells-slider").resize()}))})),c(window).load((function(){c(".cc-compass .cc-compass-count").show()}));var e=!0;function o(t){if(e){e=!1,c(".cc-notice").hide();var a=c(t).parents(".cc-cart-product-list"),o=c(a).find(".cc_item_quantity"),n=c(o).data("key"),s=c(o).data("product_id"),i=parseInt(c(o).val());"minus"==c(t).data("type")?i--:i++,i<1&&(i=1);var r={key:n,number:i,product_id:s,security:cc_ajax_script.nonce};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_quantity_update"),data:r,beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments,n=t.qty_error_msg;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),n&&(c(".cc-notice").addClass("cc-error").show().html(n),setTimeout((function(){c(".cc-notice").removeClass("cc-error").html("").hide()}),2e3)),c(o).val(i),e=!0,new Tabby("[data-tabs]").toggle("#cc-cart")}})}}function n(t){var a=t.data("product_id"),e=t.data("cart_item_key"),o={security:cc_ajax_script.nonce,product_id:a,cart_item_key:e};c.ajax({type:"post",dataType:"json",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_save_for_later"),data:o,beforeSend:function(a){c("#cc-cart").css("opacity","0.3"),t.addClass("cc_hide_btn"),t.parent().find(".cc-loader").show()},complete:function(a){t.removeClass("cc_hide_btn"),t.parent().find(".cc-loader").hide(),c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),new Tabby("[data-tabs]").toggle("#cc-saves")}})}function s(t){var e=t.data("product_id"),o={security:cc_ajax_script.nonce,product_id:e};c.ajax({type:"post",dataType:"json",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_move_to_cart"),data:o,beforeSend:function(c){t.addClass("cc_hide_btn"),t.parent().find(".cc-loader").show()},success:function(e){e.error?(t.removeClass("cc_hide_btn"),t.parent().find(".cc-loader").hide(),new Tabby("[data-tabs]").toggle("#cc-saves"),c(".cc-sfl-notice").show().html(e.error_message),setTimeout((function(){c(".cc-sfl-notice").html("").hide()}),2e3)):a("move_to_cart")}})}function i(t){var a=t.data("product_id"),e={nonce:cc_ajax_script.nonce,product_id:a};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_remove_item_from_sfl"),data:e,beforeSend:function(t){c("#cc-saves").css("opacity","0.3")},complete:function(t){c("#cc-saves").css("opacity","1")},success:function(t){var a=t.fragments;a&&c.each(a,(function(t,a){c(t).replaceWith(a)}));var e=c("a.cc-sfl-btn.remove_from_sfl_button");e.has("i.ccicon-heart-filled")&&(e.find("i").removeClass("ccicon-heart-filled").addClass("ccicon-heart-empty"),e.find("span").text().length>0&&e.find("span").text("Save for later"),e.removeClass("remove_from_sfl_button").addClass("cc_add_product_to_sfl"));new Tabby("[data-tabs]").toggle("#cc-saves")}})}function r(){c(".cc-pl-info-container").hide(),c(".cc-window-wrapper").show()}function d(){c(".cc-compass").toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open"),c(".cc-pl-info-container").hide(),c(".cc-window-wrapper").show(),c(".cc-overlay").show(),new Tabby("[data-tabs]").toggle("#cc-saves"),t.animate({right:"0"},"slow").addClass("visible")}function l(){t.hasClass("visible")||c(".cc-compass").trigger("click")}function _(){var t=c(".cc-coupon-form #cc_coupon_code").val(),a={nonce:cc_ajax_script.nonce,coupon_code:t};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_apply_coupon_to_cart"),data:a,beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments,e=t.caddy_cart_subtotal;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),c(".cc-total-amount").html(e),new Tabby("[data-tabs]").toggle("#cc-cart")}})}function u(t){var a=t.parent(".cc-applied-coupon").find(".cc_applied_code").text(),e={nonce:cc_ajax_script.nonce,coupon_code_to_remove:a};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_remove_coupon_code"),data:e,beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments,e=t.free_shipping_title,o=t.free_shipping_meter,n=t.final_cart_subtotal;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),c(".cc-fs-title").html(e),c(".cc-fs-meter").html(o),c(".cc-total-amount").html(n),new Tabby("[data-tabs]").toggle("#cc-cart")}})}}(jQuery);
     1!function(c){"use strict";var t=c(".cc-window");function a(t=""){c.ajax({type:"post",url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(a){var e=a.fragments;if(e&&c.each(e,(function(t,a){c(t).replaceWith(a)})),new Tabby("[data-tabs]").toggle("#cc-cart"),"yes"==t&&c(".cc-window-wrapper").hide(),"move_to_cart"===t&&(c(".cc_cart_from_sfl").removeClass("cc_hide_btn"),c(".cc_cart_from_sfl").parent().find(".cc-loader").hide(),c(".cc-coupon .woocommerce-notices-wrapper").remove(),c(".cc-cart").removeAttr("hidden")),"no"===a.flatsome_product_redirect)return!1}})}jQuery(document).ready((function(c){setTimeout((function(){a()}),200),c(".cc-nav ul li a").mousedown((function(){c(this).addClass("using-mouse")})),c("body").keydown((function(){c(".cc-nav ul li a").removeClass("using-mouse")}));var e=new Tabby("[data-tabs]");c(document).mouseup((function(a){var e=c(".cc-window.visible, .cc-compass, #toast-container");e.is(a.target)||0!==e.has(a.target).length||t.hasClass("visible")&&(c(".cc-compass").toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open"),c(".cc-overlay").hide(),t.animate({right:"-1000px"},"slow").removeClass("visible"),c("#toast-container").length>0&&c("#toast-container").animate({right:"25px"},"fast").toggleClass("cc-toast-open"))})),c(document).on("click",".cc-compass",(function(){c(this).toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open"),t.hasClass("visible")?(c(".cc-overlay").hide(),t.animate({right:"-1000px"},"slow").removeClass("visible")):(c(".cc-overlay").show(),e.toggle("#cc-cart"),t.animate({right:"0"},"slow").addClass("visible"))})),c(document).on("click",".ccicon-x",(function(){c(".cc-overlay").hide(),t.animate({right:"-1000px"},"slow").removeClass("visible"),c(".cc-compass").toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open")})),c(document).on("click",".cc-cart-product-list .cc-cart-product a.remove_from_cart_button",(function(){i(c(this))})),c(document).on("click","a.remove_from_sfl_button",(function(){r(c(this))})),c("body").on("added_to_cart",(function(a,e,o,n){var s=c(".cc-compass-desk-notice").val(),i=c(".cc-compass-mobile-notice").val();cc_ajax_script.is_mobile&&!t.hasClass("visible")&&"mob_disable_notices"===i?setTimeout((function(){c(".cc-compass").trigger("click")}),20):cc_ajax_script.is_mobile||t.hasClass("visible")||"desk_disable_notices"!==s&&"desk_notices_caddy_window"!==s&&""!==s||setTimeout((function(){c(".cc-compass").trigger("click")}),20)})),c(document).on("click",".single_add_to_cart_button",(function(t){if(t.preventDefault(),!c(this).hasClass("disabled")){if(!(c(this).hasClass("product_type_variable")||c(this).hasClass("product_type_bundle")||c(this).hasClass("product_type_external"))){var e=c(this),o=e.closest("form.cart").serializeArray(),n=!1;if(c.each(o,(function(c,t){if(("productID"===t.name||"add-to-cart"===t.name)&&t.value)return n=!0,!1})),!n)var s=c(this).data("product_id");if(e.attr("name")&&"add-to-cart"==e.attr("name")&&e.attr("value"))s=e.attr("value");return s&&o.push({name:"add-to-cart",value:s}),o.push({name:"action",value:"cc_add_to_cart"}),c(document.body).trigger("adding_to_cart",[e,o]),c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_add_to_cart"),data:c.param(o),beforeSend:function(t){c("#cc-cart").css("opacity","0.3"),c(".cc-compass").find(".licon").hide(),c(".cc-compass").find(".cc-loader").show(),c("form.cart").length>0&&e.removeClass("added").addClass("loading")},success:function(t){t.error&&t.product_url?window.location.reload():e.hasClass("add_to_cart_button")||(a(),c(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,e]))},complete:function(t){c(".cc-compass").find(".cc-loader").hide(),c(".cc-compass").find(".licon").show(),c("form.cart").length>0&&e.addClass("added").removeClass("loading"),c("#cc-cart").css("opacity","1")}}),!1}var i=c(this).attr("href");window.location=i}})),c(document).on("click",".cc-pl-info .cc-pl-actions .cc-view-cart",(function(){e.toggle("#cc-cart")})),c(document).on("click",".cc_item_quantity_update",(function(){o(c(this))})),c(document).on("click",".save_for_later_btn",(function(){n(c(this))})),c(document).on("click",".cc_cart_from_sfl",(function(){s(c(this))})),c(document).on("click",".cc_back_to_cart",(function(){d()})),c(document).on("click",".added_to_cart.wc-forward, .woocommerce-error .button.wc-forward",(function(c){c.preventDefault(),_()})),c(document).on("click",".cc_saved_items_list",(function(){l()})),c(document).on("click",".cc_cart_items_list",(function(){_()})),c(document).on("click",".cc-view-saved-items",(function(){new Tabby("[data-tabs]").toggle("#cc-saves")})),c(".variations_form").length>0&&(c(".cc_add_product_to_sfl").addClass("disabled"),c(this).each((function(){c(this).on("found_variation",(function(t,a){c(".cc_add_product_to_sfl").removeClass("disabled")})),c(this).on("reset_data",(function(){c(".cc_add_product_to_sfl").addClass("disabled")}))}))),c(document).on("submit","#apply_coupon_form",(function(c){c.preventDefault(),u()})),c(document).on("click",".cc-applied-coupon .cc-remove-coupon",(function(){p(c(this))})),c(document).on("click",".cc-nav ul li a",(function(){"cc-cart"===c(this).attr("data-id")&&c(".cc-pl-upsells-slider").resize()}))})),c(window).on("load",(function(){c(".cc-compass .cc-compass-count").show()}));var e=!0;function o(t){if(e){e=!1,c(".cc-notice").hide();var a=c(t).parents(".cc-cart-product-list"),o=c(a).find(".cc_item_quantity"),n=c(o).data("key"),s=c(o).data("product_id"),i=parseInt(c(o).val());"minus"==c(t).data("type")?i--:i++,i<1&&(i=1);var r={key:n,number:i,product_id:s,security:cc_ajax_script.nonce};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_quantity_update"),data:r,beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments,n=t.qty_error_msg;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),n&&(c(".cc-notice").addClass("cc-error").show().html(n),setTimeout((function(){c(".cc-notice").removeClass("cc-error").html("").hide()}),2e3)),c(o).val(i),e=!0,new Tabby("[data-tabs]").toggle("#cc-cart")}})}}function n(t){var a=t.data("product_id"),e=t.data("cart_item_key"),o={security:cc_ajax_script.nonce,product_id:a,cart_item_key:e};c.ajax({type:"post",dataType:"json",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_save_for_later"),data:o,beforeSend:function(a){c("#cc-cart").css("opacity","0.3"),t.addClass("cc_hide_btn"),t.parent().find(".cc-loader").show()},complete:function(a){t.removeClass("cc_hide_btn"),t.parent().find(".cc-loader").hide(),c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),new Tabby("[data-tabs]").toggle("#cc-saves")}})}function s(t){var e=t.data("product_id"),o={security:cc_ajax_script.nonce,product_id:e};c.ajax({type:"post",dataType:"json",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_move_to_cart"),data:o,beforeSend:function(c){t.addClass("cc_hide_btn"),t.parent().find(".cc-loader").show()},success:function(e){e.error?(t.removeClass("cc_hide_btn"),t.parent().find(".cc-loader").hide(),new Tabby("[data-tabs]").toggle("#cc-saves"),c(".cc-sfl-notice").show().html(e.error_message),setTimeout((function(){c(".cc-sfl-notice").html("").hide()}),2e3)):a("move_to_cart")}})}function i(t){var a=t.data("cart_item_key"),e=(t.data("product_name"),t.data("product_id")),o={nonce:cc_ajax_script.nonce,cart_item_key:a};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_remove_item_from_cart"),data:o,complete:function(t){c(".single_add_to_cart_button, .add_to_cart_button").length>0&&c(".single_add_to_cart_button.added, .add_to_cart_button.added").each((function(){if(c("form.cart").length>0&&!c(this).hasClass("add_to_cart_button")){var t=c(this).closest("form.cart"),a=t.find("input[name=add-to-cart]").val()||c(this).val(),o=t.find("input[name=variation_id]").val()||0;0!==o&&(a=o)}else a=c(this).data("product_id");a==e&&c(this).hasClass("added")&&c(this).removeClass("added")}))},success:function(t){var a=t.fragments;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),new Tabby("[data-tabs]").toggle("#cc-cart")}})}function r(t){var a=t.data("product_id"),e={nonce:cc_ajax_script.nonce,product_id:a};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_remove_item_from_sfl"),data:e,beforeSend:function(t){c("#cc-saves").css("opacity","0.3")},complete:function(t){c("#cc-saves").css("opacity","1")},success:function(t){var a=t.fragments;a&&c.each(a,(function(t,a){c(t).replaceWith(a)}));var e=c("a.cc-sfl-btn.remove_from_sfl_button");e.has("i.ccicon-heart-filled")&&(e.find("i").removeClass("ccicon-heart-filled").addClass("ccicon-heart-empty"),e.find("span").text().length>0&&e.find("span").text("Save for later"),e.removeClass("remove_from_sfl_button").addClass("cc_add_product_to_sfl"));new Tabby("[data-tabs]").toggle("#cc-saves")}})}function d(){c(".cc-pl-info-container").hide(),c(".cc-window-wrapper").show()}function l(){c(".cc-compass").toggleClass("cc-compass-open"),c("body").toggleClass("cc-window-open"),c(".cc-pl-info-container").hide(),c(".cc-window-wrapper").show(),c(".cc-overlay").show(),new Tabby("[data-tabs]").toggle("#cc-saves"),t.animate({right:"0"},"slow").addClass("visible")}function _(){t.hasClass("visible")||c(".cc-compass").trigger("click")}function u(){var t=c(".cc-coupon-form #cc_coupon_code").val(),a={nonce:cc_ajax_script.nonce,coupon_code:t};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_apply_coupon_to_cart"),data:a,beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments,e=t.caddy_cart_subtotal;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),c(".cc-total-amount").html(e),new Tabby("[data-tabs]").toggle("#cc-cart")}})}function p(t){var a=t.parent(".cc-applied-coupon").find(".cc_applied_code").text(),e={nonce:cc_ajax_script.nonce,coupon_code_to_remove:a};c.ajax({type:"post",url:cc_ajax_script.wc_ajax_url.toString().replace("%%endpoint%%","cc_remove_coupon_code"),data:e,beforeSend:function(t){c("#cc-cart").css("opacity","0.3")},complete:function(t){c("#cc-cart").css("opacity","1")},success:function(t){var a=t.fragments,e=t.free_shipping_title,o=t.free_shipping_meter,n=t.final_cart_subtotal;a&&c.each(a,(function(t,a){c(t).replaceWith(a)})),c(".cc-fs-title").html(e),c(".cc-fs-meter").html(o),c(".cc-total-amount").html(n),new Tabby("[data-tabs]").toggle("#cc-cart")}})}}(jQuery);
Note: See TracChangeset for help on using the changeset viewer.