Plugin Support
Doug – a11n
(@dougaitken)
Automattic Happiness Engineer
Hey @coresince84
Great question! I tried a few ways with this myself but I wasn’t successful so I’ll ask one of the developers to take a look if they can.
Thanks,
Thread Starter
rainerd
(@coresince84)
I solved it already with an If Statement and a custom field checkbox on the single product page backend to set if the product should not have the buttons. Will post the code later.
Plugin Support
Doug – a11n
(@dougaitken)
Automattic Happiness Engineer
Hey @coresince84
I only now saw your reply but I wanted to reply here with one solution:
add_filter( 'wc_stripe_hide_payment_request_on_product_page', function( $hide, $post ) {
if ( $post->ID === 36 ) { // Change 36 to the Product ID that you want to hide
return true;
}
return $hide;
}, 10, 2 );
As you’ve mentioned you have a solution and I’ve tested this solution and it works, I’ll mark this as Resolved.
Thanks,
Thread Starter
rainerd
(@coresince84)
Thanks. This is my solution, based on a custom field called “hide_payment_request_buttons_apple_pay” to be more scalable and setting being adjustable via the product editor.
add_action( 'woocommerce_before_single_product', 'woo_control_payment_request' );
function woo_control_payment_request() {
if ( get_field( 'hide_payment_request_buttons_apple_pay' ) ) {
add_filter( 'wc_stripe_hide_payment_request_on_product_page', '__return_true' );
}
}
-
This reply was modified 2 years, 1 month ago by
rainerd.
-
This reply was modified 2 years, 1 month ago by
rainerd.