Merge pull request #353 from helgatheviking/issues/234-supports

This commit is contained in:
leonardo lopes de albuquerque 2022-05-10 10:05:59 -03:00 committed by GitHub
commit e6775ce3fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -522,11 +522,10 @@ class SmartButton implements SmartButtonInterface {
*/ */
public function button_renderer() { public function button_renderer() {
$product = wc_get_product(); $product = wc_get_product();
if ( if (
! is_checkout() && is_a( $product, \WC_Product::class ) ! is_checkout() && is_a( $product, \WC_Product::class )
&& ( && ( ! apply_filters( 'woocommerce_paypal_payments_product_supports_payment_request_button', ! $product->is_type( array( 'external', 'grouped' ) ) && $product->is_in_stock(), $product )
$product->is_type( array( 'external', 'grouped' ) )
|| ! $product->is_in_stock()
) )
) { ) {
@ -548,6 +547,15 @@ class SmartButton implements SmartButtonInterface {
* Renders the HTML for the credit messaging. * Renders the HTML for the credit messaging.
*/ */
public function message_renderer() { public function message_renderer() {
$product = wc_get_product();
if (
! is_checkout() && is_a( $product, \WC_Product::class )
&& ( ! apply_filters( 'woocommerce_paypal_payments_product_supports_payment_request_button', ! $product->is_type( array( 'external', 'grouped' ) ) && $product->is_in_stock(), $product )
)
) {
return;
}
echo '<div id="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>'; echo '<div id="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>';
} }