PageSourceSearch

https://www.techwhis.com/wp-content/plugins/woocommerce-external-v…erce-external-variations.js?ver=14946599864

js techwhis.com collected 2026-10-08 08:53:50 UTC 2,233 bytes, 79 lines download raw bytes

1jQuery( document ).ready( function( $ ) {
2
3	'use strict';
4
5	var delay = 200;
6	var try_button = 0;
7	var button_ok = false;
8
9	function woocommerce_external_variations_set_front_end() {
10
11		try_button += 1;
12
13		var product_id = $( 'div.product-type-variable input[ name="product_id" ]' ).attr( 'value' );
14		var variation_id = $( 'div.product-type-variable input[ name="variation_id" ]' ).attr( 'value' );
15		var data = {
16			'action': 'woocommerce_external_variations_get_arguments',
17			'product_id': product_id,
18			'variation_id': variation_id,
19		};
20
21		if ( product_id ) {
22
23			jQuery.post( ajax_object.ajax_url, data, function( response ) {
24
25				// Parse response array
26				var parsed_response = jQuery.parseJSON( response );
27
28				// Check if external variations is enabled
29				if ( parsed_response.button_enabled == 'yes' ) {
30
31					// Update front end
32					var target_url = parsed_response.button_url;
33					if ( !target_url ) {
34						target_url = parsed_response.button_default_url;
35					}
36					if ( target_url ) {
37						$( 'div.product-type-variable form.cart button' ).show();
38						$( 'div.product-type-variable form.cart' ).attr( 'action', target_url );
39						$( 'div.product-type-variable form.cart' ).attr( 'target', '_blank' );
40						button_ok = true;
41					} else {
42						$( 'div.product-type-variable form.cart button' ).hide();
43						if ( try_button < 10 && !button_ok ) {
44							setTimeout( woocommerce_external_variations_set_front_end, delay );
45						}
46					}
47					$( 'div.product-type-variable form.cart button' ).text( parsed_response.button_text );
48
49				}
50
51			});
52
53		} else {
54
55			if ( try_button < 10 && !button_ok ) {
56				setTimeout( woocommerce_external_variations_set_front_end, delay );
57			}
58
59		}
60
61	}
62
63	function woocommerce_external_variations_delay() {
64
65		try_button = 0;
66		button_ok = false;
67		$( 'div.product-type-variable form.cart button' ).hide();
68		setTimeout( woocommerce_external_variations_set_front_end, delay );
69
70	}
71
72	// Actions
73	$( 'div.product-type-variable table.variations select' ).on( 'change', woocommerce_external_variations_delay );
74	$( 'div.product-type-variable a.reset_variations' ).on( 'click', woocommerce_external_variations_delay );
75
76	// Start
77	woocommerce_external_variations_delay();
78
79});

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.