Plugin Directory

Changeset 3154154


Ignore:
Timestamp:
09/18/2024 08:32:41 PM (19 months ago)
Author:
tknuth
Message:

Add lookup on another css checkout button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • checkoutchamp/trunk/includes/functions/Functions_Loader.php

    r3147568 r3154154  
    4848            let fourth_button = false; // Variable pour suivre l'état de la requête
    4949            let fifith_button = false; // Variable pour suivre l'état de la requête
     50            let sixth_button = false; // Variable pour suivre l'état de la requête
    5051
    5152            if (jQuery('.checkout-button').length) {
     
    6465                jQuery('.button.checkout.wc-forward').css('visibility', 'hidden');
    6566            }
    66 
    67 
     67            if (jQuery('.wc-block-components-button.wp-element-button.wc-block-cart__submit-button').length) {
     68                jQuery('.wc-block-components-button.wp-element-button.wc-block-cart__submit-button').css('visibility', 'hidden');
     69            }
    6870
    6971            setButtons()
     
    180182                    }
    181183
     184
     185                    if (jQuery('.wc-block-components-button.wp-element-button.wc-block-cart__submit-button').length && !sixth_button) {
     186                        sixth_button = true;
     187
     188                        jQuery.ajax({
     189                            url: checkoutchamp_fonctions.ajax_url,
     190                            type: 'POST',
     191                            data: {
     192                                action: 'checkoutchamp_get_checkout_button',
     193                                nonce: checkoutchamp_fonctions.checkoutchamp_get_checkout_button_nonce
     194                            },
     195                            success: async function(response) {
     196                                if (response !== jQuery('.wc-block-components-button.wp-element-button.wc-block-cart__submit-button').attr('href'))
     197                                    jQuery('.wc-block-components-button.wp-element-button.wc-block-cart__submit-button').attr('href', response.data.href);
     198                            },
     199                            complete: function() {
     200                                jQuery('.wc-block-components-button.wp-element-button.wc-block-cart__submit-button').css('visibility', 'visible');
     201                                sixth_button = false;
     202                            }
     203                        });
     204                    }
    182205
    183206
Note: See TracChangeset for help on using the changeset viewer.