PageSourceSearch

https://datenschutz-generator.de/wp-content/plugins/cart-upsell-fo…-upsell-for-woocommerce-public.js?ver=1.0.8

js datenschutz-generator.de collected 2026-10-01 08:39:44 UTC 2,341 bytes, 104 lines download raw bytes

1/**
2 * All of the code for your public-facing JavaScript source
3 * should reside in this file.
4 *
5 * @package           Cart_Upsell_For_Woocommerce
6 * Note: It has been assumed you will write jQuery code here, so the
7 * $ function reference has been prepared for usage within the scope
8 * of this function.
9 *
10 * This enables you to define handlers, for when the DOM is ready:
11 */
12
13(function( $ ) {
14	'use strict';
15
16	/**
17	 * All of the code for your public-facing JavaScript source
18	 * should reside in this file.
19	 *
20	 * Note: It has been assumed you will write jQuery code here, so the
21	 * $ function reference has been prepared for usage within the scope
22	 * of this function.
23	 *
24	 * This enables you to define handlers, for when the DOM is ready:
25	 *
26	 * $(function() {
27	 *
28	 * });
29	 *
30	 * When the window is loaded:
31	 *
32	 * $( window ).load(function() {
33	 *
34	 * });
35	 *
36	 * ...and/or other possibilities.
37	 *
38	 * Ideally, it is not considered best practise to attach more than a
39	 * single DOM-ready or window-load handler for a particular page.
40	 * Although scripts in the WordPress core, Plugins and Themes may be
41	 * practising this, we should strive to set a better example in our own work.
42	 */
43
44	jQuery( document ).on(
45		'click',
46		'.upsell_add_to_cart_cta',
47		function(event){
48			event.preventDefault();
49			var $thisbutton = jQuery( this );
50			var product_id  = jQuery( this ).attr( 'data-id' );
51			var nonce       = jQuery( this ).attr( 'data-nonce' );
52
53			var data = {
54				action: 'cart_upsell_ajax_add_to_cart',
55				product_id: product_id,
56				product_sku: '',
57				quantity: 1,
58				nonce: nonce,
59			};
60
61			jQuery( document ).trigger( 'adding_to_cart', [$thisbutton, data] );
62
63			$.ajax(
64				{
65					type: 'post',
66					url: ajaxurl,
67					data: data,
68					beforeSend: function (response) {
69
70					},
71					complete: function (response) {
72
73					},
74					success: function (response) {
75
76						if (response.error & response.product_url) {
77							window.location = response.product_url;
78							return;
79						} else {
80							jQuery( document ).trigger( 'added_to_cart', [response.fragments, response.cart_hash, $thisbutton] );
81						}
82					},
83				}
84			);
85
86			return false;
87
88		}
89	);
90
91	jQuery( document ).on(
92		'updated_wc_div',
93		function(){
94
95		}
96	);
97	jQuery( document ).on(
98		'updated_cart_totals',
99		function(){
100
101		}
102	);
103
104})( jQuery );

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.