PageSourceSearch

https://www.eety.at/wp-content/plugins/woocommerce-germanized/build/static/cart-voucher.js?ver=3.20.3

js eety.at collected 2026-10-01 15:37:10 UTC 4,683 bytes, 126 lines download raw bytes

1/******/ (function() { // webpackBootstrap
2var __webpack_exports__ = {};
3/*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order */
4window.germanized = window.germanized || {};
5(function ($, germanized) {
6  /**
7   * Order Data Panel
8   */
9  germanized.cart_voucher = {
10    params: {},
11    vouchers: {},
12    init: function () {
13      this.params = wc_gzd_cart_voucher_params;
14      this.vouchers = wc_gzd_cart_voucher_params.vouchers;
15      if ($('.woocommerce-checkout').length) {
16        this.manipulate_checkout_totals();
17      }
18      if ($('.woocommerce-cart-form').length) {
19        this.manipulate_cart_totals();
20      }
21      $(document.body).on('updated_cart_totals', this.manipulate_cart_totals);
22      $(document.body).on('updated_checkout', this.manipulate_checkout_totals);
23      $(document.body).on('applied_coupon', this.refresh_cart_vouchers);
24      $(document.body).on('removed_coupon', this.refresh_cart_vouchers);
25    },
26    refresh_cart_vouchers: function () {
27      var self = germanized.cart_voucher;
28      setTimeout(function () {
29        $.ajax({
30          type: 'POST',
31          url: self.params.wc_ajax_url.toString().replace('%%endpoint%%', 'gzd_refresh_cart_vouchers'),
32          data: {
33            security: self.params.refresh_cart_vouchers_nonce
34          },
35          success: function (data) {
36            self.vouchers = data.vouchers;
37            self.manipulate_cart_totals();
38          },
39          dataType: 'json'
40        });
41      }, 75);
42    },
43    manipulate_checkout_totals: function (e, ajaxData) {
44      var self = germanized.cart_voucher,
45        $table = $('.woocommerce-checkout #order_review table');
46      ajaxData = typeof ajaxData === 'undefined' ? {} : ajaxData;
47
48      /**
49       * Refresh new voucher data by fragments
50       */
51      if (ajaxData.hasOwnProperty('fragments') && ajaxData.fragments.hasOwnProperty('.gzd-vouchers')) {
52        self.vouchers = ajaxData.fragments['.gzd-vouchers'];
53      }
54      if (!self.params.display_prices_including_tax) {
55        self.move_vouchers_before_total_checkout();
56      }
57      self.manipulate_coupons($table);
58    },
59    manipulate_cart_totals: function () {
60      var $table = $('.cart_totals table'),
61        $total = $table.find('tr.order-total'),
62        self = germanized.cart_voucher;
63      if (!self.params.display_prices_including_tax) {
64        self.move_vouchers_before_total($table, $total);
65        if ($('.woocommerce-checkout').length) {
66          self.move_vouchers_before_total_checkout();
67        }
68      }
69      self.manipulate_coupons($table);
70    },
71    manipulate_coupons: function ($table) {
72      var self = germanized.cart_voucher;
73      $.each(self.vouchers, function (voucherId, voucher) {
74        var $coupon = self.get_voucher_coupon(voucher, $table),
75          $fee = self.get_voucher_fee(voucher, $table);
76        $coupon.hide();
77        if ($fee.length > 0 && $coupon.length > 0) {
78          var $remove_link = $coupon.find('a.woocommerce-remove-coupon');
79          if ($remove_link.length > 0) {
80            $fee.find('td:last').append(" ");
81            $fee.find('td:last').append($remove_link);
82          }
83        }
84      });
85    },
86    move_vouchers_before_total_checkout: function () {
87      var $table = $('.woocommerce-checkout #order_review table'),
88        $total = $table.find('tr.order-total'),
89        self = germanized.cart_voucher;
90      self.move_vouchers_before_total($table, $total);
91    },
92    get_voucher_fee: function (voucher, $table) {
93      var $fee = false;
94      $table.find('tr.fee').each(function () {
95        $tr = $(this);
96        var title = $tr.find('th').text();
97        var maybeVoucherTitle = title.substr(title.length - voucher.code.length);
98        if (maybeVoucherTitle === voucher.code) {
99          $fee = $tr;
100        }
101      });
102      if (!$fee) {
103        $fee = $table.find('tr.fee th:contains("' + voucher.name + '")').parents('tr');
104      }
105      return $fee;
106    },
107    get_voucher_coupon: function (voucher, $table) {
108      return $table.find('tr.' + voucher.coupon_class);
109    },
110    move_vouchers_before_total: function ($table, $total) {
111      var self = germanized.cart_voucher;
112      $.each(self.vouchers, function (voucherId, voucher) {
113        var $fee = self.get_voucher_fee(voucher, $table);
114        if ($fee.length > 0) {
115          $fee.insertBefore($total);
116        }
117      });
118    }
119  };
120  $(document).ready(function () {
121    germanized.cart_voucher.init();
122  });
123})(jQuery, window.germanized);
124((window.germanized = window.germanized || {})["static"] = window.germanized["static"] || {})["cart-voucher"] = __webpack_exports__;
125/******/ })()
126;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.