Skip to content

Instantly share code, notes, and snippets.

@pramodjodhani
Created February 28, 2024 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pramodjodhani/8ae7616875212e21991df32cc17c183a to your computer and use it in GitHub Desktop.
Save pramodjodhani/8ae7616875212e21991df32cc17c183a to your computer and use it in GitHub Desktop.
flux - payment plugin apple pay button relocate
add_action(
'wp_head',
function() {
if ( is_checkout() ) {
?>
<style>
/* Hide the other express checkout containers generated by other gateway plugins. */
.wc-stripe-banner-checkout,
.wc-ppcp-express-checkout {
display: none !important;
}
</style>
<script>
jQuery(document).ready( function() {
window.setTimeout( function() {
// Re-locate Paypal button.
jQuery( '#wc-ppcp-express-button' ).appendTo( jQuery( '.flux-express-checkout-wrap' ) ).wrap( "<div class='flux-express-checkout__btn'></div>" );
// Re-locate Google Pay button.
jQuery( '.gpay-button-fill:first-child' ).appendTo( jQuery( '.flux-express-checkout-wrap' ) ).wrap( "<div class='flux-express-checkout__btn'></div>" );
// Re-locate Apple Pay button.
jQuery( '.apple-pay-button' ).appendTo( jQuery( '.flux-express-checkout-wrap' ) ).wrap( "<div class='flux-express-checkout__btn'></div>" );
}, 1000 );
} );
</script>
<?php
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment