Skip to content

Instantly share code, notes, and snippets.

@dougaitken
Last active August 11, 2022 10:59
Show Gist options
  • Save dougaitken/79922e6a8e0999307dd719f25e98b36a to your computer and use it in GitHub Desktop.
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
I'm removing this for now as it broke some point due to code changes. I may revert in the future. I'm glad it helped some folks in the past.
@alcoolio
Copy link

awesome, thanks mate!

@espiat
Copy link

espiat commented Dec 20, 2021

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