PageSourceSearch

https://premiumcoding.com/wp-content/plugins/pp-edd-fastspring/assets/js/checkout.js

js premiumcoding.com collected 2026-09-24 19:02:36 UTC 3,513 bytes, 111 lines download raw bytes

1var ppeddfsFormClass = 'pp-edd-fs-checkout-form';
2
3(function ( $ ) {
4	// Reset the FS session and pass the FastSpring session object for the JS builder.
5	fastspring.builder.reset();
6
7	if ( '' !== PPEDDFS_CHECKOUT.payload && '' !== PPEDDFS_CHECKOUT.key ) {
8		fastspring.builder.secure( PPEDDFS_CHECKOUT.payload, PPEDDFS_CHECKOUT.key );
9	}
10
11	/**
12	 * Set the EDD checkout form, by removing and replacing some of the checkout elements.
13	 * This event: 'edd_gateway_loaded' only fires, when you switch to a different payment gateway.
14	 */
15	$( document ).on( 'edd_gateway_loaded', function() {
16		$( '#edd_payment_mode_select' ).remove();
17		$( '#edd_checkout_user_info' ).remove();
18		$( '#edd_cc_address' ).remove();
19		$( '#edd_cc_fields' ).remove();
20		$( '#edd_checkout_login_register' ).remove();
21		$( '.edd_cart_subtotal_row' ).remove();
22		$( '.edd_cart_tax_row' ).remove();
23
24		$( '#edd_purchase_form' ).addClass( ppeddfsFormClass );
25	} );
26
27	/**
28	 * Execute the FS checkout on EDD checkout button.
29	 * Change the checkout form submit functionality.
30	 */
31	$( document ).on( 'submit', '.' + ppeddfsFormClass, function( event ) {
32		event.preventDefault();
33
34		// Execute the FastSpring checkout.
35		fastspring.builder.checkout();
36	} );
37
38	/**
39	 * If there is no other EDD gateway to choose from, then trigger the EDD gateway loaded event,
40	 * so that the checkout form is set correctly.
41	 */
42	$( window ).on( 'load', function() {
43		$( document ).trigger( 'edd_gateway_loaded' );
44	} );
45
46	/**
47	 * Refresh the page after the EDD discount is applied, so that the new FS prices are displayed.
48	 */
49	$( document ).on( 'edd_discount_applied', function () {
50		// Hide the total price, because it's the EDD calculated total.
51		$( '.edd_cart_amount' ).hide();
52
53		window.location.reload( true );
54	} );
55
56	/**
57	 * Refresh the page after the EDD discount is removed, so that the new FS prices are displayed.
58	 */
59	$( document ).on( 'edd_discount_removed', function () {
60		// Hide the total price, because it's the EDD calculated total.
61		$( '.edd_cart_amount' ).hide();
62
63		window.location.reload( true );
64	} );
65
66	/**
67	 * Refresh the page after the EDD quantity is changed, so that the new FS prices are displayed.
68	 */
69	$( document ).on( 'edd_quantity_updated', function () {
70		// Hide the total price, because it's the EDD calculated total.
71		$( '.edd_cart_amount' ).hide();
72
73		window.location.reload( true );
74	} );
75
76	/**
77	 * Remove the default EDD price in the checkout cart table and display the FS price instead.
78	 */
79	$( '.js-pp-edd-cart-item-price' ).each( function () {
80		$( this ).siblings( '.edd_cart_item_price' ).remove();
81		$( this ).addClass( 'edd_cart_item_price' );
82	} );
83
84	/**
85	 * Remove the default EDD total price in the checkout cart table footer.
86	 */
87	$( '.js-pp-edd-cart-total' ).each( function () {
88		$( this ).siblings( '.edd_cart_total' ).remove();
89	} );
90
91	/**
92	 * Remove the default EDD fee price in the checkout cart table and reposition the new FS price td.
93	 */
94	$( '.js-pp-edd-cart-fee-price' ).each( function () {
95		$( this ).siblings( '.edd_cart_fee_amount' ).remove();
96		$( this ).siblings( '.edd_cart_fee_label' ).after( $( this ).detach() );
97	} );
98
99})( jQuery );
100
101
102/**
103 * Reset the EDD Checkout purchase button.
104 */
105function eddCheckoutResetPurchaseButton() {
106	var $submitButton = jQuery( '.' + ppeddfsFormClass ).find( '#edd-purchase-button' );
107
108	$submitButton.val( PPEDDFS_CHECKOUT.checkout_button_text );
109	$submitButton.prop( 'disabled', false );
110	$submitButton.siblings('.edd-loading').remove();
111}

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.