PageSourceSearch

https://www.greencardvoices.org/wp-content/plugins/woocommerce-sub…/assets/js/frontend/wcs-cart.js?ver=6.2.0

js greencardvoices.org collected 2026-09-24 10:32:41 UTC 1,847 bytes, 54 lines download raw bytes

1function hide_non_applicable_coupons() {
2	var coupon_elements = document.getElementsByClassName( 'cart-discount' );
3
4	for ( var i = 0; i < coupon_elements.length; i++ ) {
5		if (
6			0 !==
7			coupon_elements[ i ].getElementsByClassName( 'wcs-hidden-coupon' )
8				.length
9		) {
10			coupon_elements[ i ].style.display = 'none';
11		}
12	}
13}
14
15hide_non_applicable_coupons();
16
17jQuery( function ( $ ) {
18	$( document.body ).on( 'updated_cart_totals updated_checkout', function () {
19		hide_non_applicable_coupons();
20	} );
21
22	/**
23	 * Update all subscriptions shipping methods which inherit the chosen method from the initial
24	 * cart when the customer changes the shipping method.
25	 */
26	$( document ).on(
27		'change',
28		'select.shipping_method, :input[name^=shipping_method]',
29		function( event ) {
30			var shipping_method_option = $( event.target );
31			var shipping_method_id     = shipping_method_option.val();
32			var package_index          = shipping_method_option.data( 'index' );
33
34			// We're only interested in the initial cart shipping method options which have int package indexes.
35			if ( ! Number.isInteger( package_index ) ) {
36				return;
37			}
38
39			// Find all recurring cart info elements with the same package index as the changed shipping method.
40			$( '.recurring-cart-shipping-mapping-info[data-index=' + package_index + ']' ).each( function() {
41				// Update the corresponding subscription's hidden chosen shipping method.
42				$( 'input[name="shipping_method[' + $( this ).data( 'recurring_index' ) + ']"]' ).val( shipping_method_id );
43			} );
44		}
45	);
46
47	$( '.payment_methods [name="payment_method"]' ).on( 'click', function () {
48		if ( $( this ).hasClass( 'supports-payment-method-changes' ) ) {
49			$( '.update-all-subscriptions-payment-method-wrap' ).show();
50		} else {
51			$( '.update-all-subscriptions-payment-method-wrap' ).hide();
52		}
53	} );
54} );

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.