Allow button renderer hook to be filtered

This commit is contained in:
Kirill Braslavsky 2021-07-26 09:58:54 +03:00
parent c3405cb464
commit fb32cec67b
No known key found for this signature in database
GPG key ID: 61737D0C41BF3E75

View file

@ -360,7 +360,7 @@ class SmartButton implements SmartButtonInterface {
);
}
add_action( 'woocommerce_review_order_after_payment', array( $this, 'button_renderer' ), 10 );
add_action( $this->checkout_button_renderer_hook(), array( $this, 'button_renderer' ), 10 );
add_action( 'woocommerce_pay_order_after_submit', array( $this, 'button_renderer' ), 10 );
return true;
@ -963,4 +963,14 @@ class SmartButton implements SmartButtonInterface {
return $height;
}
/**
* Return action name PayPal buttons will be rendered at.
*
* @return string Action name.
*/
private function checkout_button_renderer_hook(): string
{
return (string) apply_filters('woocommerce_paypal_payments_checkout_button_renderer_hook', 'woocommerce_review_order_after_payment');
}
}