mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
introduce woocommerce_paypal_payments_product_supports_prb filter
This commit is contained in:
parent
1a5e5d88fc
commit
cda885d528
1 changed files with 11 additions and 3 deletions
|
@ -420,11 +420,10 @@ class SmartButton implements SmartButtonInterface {
|
|||
*/
|
||||
public function button_renderer() {
|
||||
$product = wc_get_product();
|
||||
|
||||
if (
|
||||
! is_checkout() && is_a( $product, \WC_Product::class )
|
||||
&& (
|
||||
$product->is_type( array( 'external', 'grouped' ) )
|
||||
|| ! $product->is_in_stock()
|
||||
&& ( ! apply_filters( 'woocommerce_paypal_payments_product_supports_prb', ! $product->is_type( array( 'external', 'grouped' ) ) && $product->is_in_stock(), $product )
|
||||
)
|
||||
) {
|
||||
return;
|
||||
|
@ -437,6 +436,15 @@ class SmartButton implements SmartButtonInterface {
|
|||
* Renders the HTML for the credit messaging.
|
||||
*/
|
||||
public function message_renderer() {
|
||||
$product = wc_get_product();
|
||||
|
||||
if (
|
||||
! is_checkout() && is_a( $product, \WC_Product::class )
|
||||
&& ( ! apply_filters( 'woocommerce_paypal_payments_product_supports_prb', ! $product->is_type( array( 'external', 'grouped' ) ) && $product->is_in_stock(), $product )
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div id="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue