For the PayPal button, try this snippet in functions.php for your child theme:
<?php
add_action( 'woocommerce_after_add_to_cart_quantity', 'my_function', 1 );
function my_function() {
$handler = new WC_Gateway_PPEC_Cart_Handler;
$handler->display_paypal_button_product();
}
And to fix the display issue, try this custom css:
.wcppec-checkout-buttons {
clear: both;
margin-top: 50px !important;
}
Custom css can be entered at:
Dashboard > Appearance > Customise > Additional CSS
Can’t help with the Stripe button.
The snippet worked fine for changing the placement in the product page but the CSS it’s not fixing the display issue.
Currently it looks like this: https://drive.google.com/file/d/1v7KsJKG_832P0VE6zpF18pU2fjZdeA0O/view?usp=sharing
Also do you have a snippet for changing the placement in the cart page?
Thanks
It doesn’t look like your image from here. Presumably Fastest Cache has been reset since you posted.
For the cart page, try:
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
add_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 30 );
and to remove the “or” which is now in the wrong place,
.wcppec-checkout-buttons__separator {
display: none !important;
}
That almost did the job…
But still it isn’t exactly the same as the product page, take a look: https://drive.google.com/file/d/1NwTtJfYJhZyBzeQ9BdjkRKsRf7iE2NK4/view?usp=sharing
Is it possible to achieve the same placement?
I think moving the default positions of both PayPal and Stripe would be turning this into a developer job. It would need a bit more code than is normally seen in a forum answer. You may have to have both after the add-to-cart as default or get someone in to code the change.
Wouldn’t it be possible to reuse similar code to the one used in the product page?
Because currently from a user experience point of view, the placement doesn’t make sense. The PayPal button is similar to Stripe Pay Now button and both of them an alternative to ‘Proceed to checkout’.
So I don’t see it as a developer job but rather something that needs to be fixed in the plugin, don’t you agree? This way everyone could benefit from this change /improvement.
There can’t be enough settings.
But WooCommerce is the primary software here, so its up to the payment gateway plugins to position themselves as they see best. WooCommerce gives plugin developers loads of hooks so they can intercept execution at a point of their choosing. You’ll need to make the repositioning suggestion on the relevant gateway forums.