alx_n_smith
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Small hack:
Place this hook on place, that you want to display payment request button: (woocommerce/chekout/*.php, I add to payment.php, after payments cycle)<?php do_action('apple_and_google_pay_payments');?>
Then add this snippet to your functions.php or any other place, before execution init hook:
if (function_exists('revolut_wc')){ $is_payment_ajax = isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'update_order_review'; if ($is_payment_ajax): add_action('woocommerce_checkout_update_order_review', function(){ define('WOOCOMMERCE_CART', true); revolut_wc(); do_action('wp_enqueue_scripts'); }); endif; add_action('apple_and_google_pay_payments', function(){ ?> <div class="radio wc_payment_method wc-revolut-payment-request"> <input id="wc-revolut-payment-request" type="radio" class="input-radio" name="payment_method" value="revolut_cc" data-order_button_text="" style="display: none;"> <label for="wc-revolut-payment-request">ApplePay/GPay</label> <div class="payment_box wc-revolut-payment-request"> <fieldset id="wc-revolut-payment-request-form" class="wc-credit-card-form wc-payment-form" style="background:transparent"> <div style="background: #f7f7f7" id="wc-revolut-payment-request-element"> <div class="wc-revolut-payment-request-instance" id="wc-revolut-payment-request-container" style="clear:both;padding-top:1.5em;"> <div id="revolut-payment-request-button"></div> </div> <?php wp_scripts()->print_scripts('revolut-woocommerce-payment-request'); ?> </div> </fieldset> </div> </div> <?php }); }
I
- This reply was modified 2 years ago by Steven Stern (sterndata). Reason: removed sugnature; flagged
Look these, small hack:
Add this string in place, what you wanna to be placed google/Apple Pay button: (e.g. woocommerce/checkout/payment.php)<?php do_action('apple_and_google_pay_payments'); ?>
Then make snippet like this in functions.php or your snippets plugin/place:
if (function_exists('revolut_wc')){ $is_payment_ajax = isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'update_order_review'; if ($is_payment_ajax): add_action('woocommerce_checkout_update_order_review', function(){ define('WOOCOMMERCE_CART', true); revolut_wc(); do_action('wp_enqueue_scripts'); }); endif; add_action('apple_and_google_pay_payments', function(){ ?> <div class="radio wc_payment_method wc-revolut-payment-request"> <input id="wc-revolut-payment-request" type="radio" class="input-radio" name="payment_method" value="revolut_cc" data-order_button_text="" style="display: none;"> <label for="wc-revolut-payment-request">ApplePay/GPay</label> <div class="payment_box wc-revolut-payment-request"> <fieldset id="wc-revolut-payment-request-form" class="wc-credit-card-form wc-payment-form" style="background:transparent"> <div style="background: #f7f7f7" id="wc-revolut-payment-request-element"> <div class="wc-revolut-payment-request-instance" id="wc-revolut-payment-request-container" style="clear:both;padding-top:1.5em;"> <div id="revolut-payment-request-button"></div> </div> <?php wp_scripts()->print_scripts('revolut-woocommerce-payment-request'); ?> </div> </fieldset> </div> </div> <?php }); }
- This reply was modified 2 years ago by alx_n_smith.
- This reply was modified 2 years ago by alx_n_smith.
- This reply was modified 2 years ago by Steven Stern (sterndata). Reason: removed telegram signature
- This reply was modified 2 years ago by Steven Stern (sterndata).
Viewing 2 replies - 1 through 2 (of 2 total)