Last active
August 11, 2022 10:59
-
-
Save dougaitken/79922e6a8e0999307dd719f25e98b36a to your computer and use it in GitHub Desktop.
[broken] Moving the WooCommerce Stripe Payment Request buttons below the add to cart button
awesome, thanks mate!
Thanks for the code.
I find out not to change the code in the plugin - because its bad practice.
add_action('init', 'der_spanier_change_stripe_express_checkout_woo_position_after_buy_button', 11);
function der_spanier_change_stripe_express_checkout_woo_position_after_buy_button()
{
remove_action('woocommerce_after_add_to_cart_quantity', array(WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html'), 1);
remove_action('woocommerce_after_add_to_cart_quantity', array(WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html'), 2);
add_action('woocommerce_after_add_to_cart_button', array(WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html'), 2);
add_action('woocommerce_after_add_to_cart_button', array(WC_Stripe_Payment_Request::instance(),
'display_payment_request_button_separator_html'), 1);
}
Merry christmas
PS: It is a mystery to me why the Stripe plugin dispels this nonsense
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just updated the Stripe plugin to 4.5.2 and had the same issue again. Had to again replace the
add_action( 'woocommerce_after_add_to_cart_quantity', array( $this, 'display_payment_request_button_html' ), 1 );
add_action( 'woocommerce_after_add_to_cart_quantity', array( $this, 'display_payment_request_button_separator_html' ), 2 );
with
add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'display_payment_request_button_html' ), 2 );
add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'display_payment_request_button_separator_html' ), 1 );
Is it not possible to accomodate the display of payment button after the add to cart button somehow so that with the next update of the plugin we do not have to manually adjust it? Thanks.