This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('woocommerce_paypal_payments_basic_checkout_validation_enabled', function($enabled) { | |
| return false; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // removes PayPal smart buttons on single product page for subscription type products | |
| function ppcp_remove_single_product_buttons( $enable_button, $product ){ | |
| if ( $product->is_type( 'subscription' ) ) { | |
| $enable_button = false; | |
| } | |
| return $enable_button; | |
| } | |
| add_action( 'woocommerce_paypal_payments_product_supports_payment_request_button', 'ppcp_remove_single_product_buttons', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( | |
| 'sgo_js_minify_exclude', | |
| function ( array $scripts ) { | |
| $scripts_to_exclude = array( 'ppcp-smart-button', 'ppcp-oxxo', 'ppcp-pay-upon-invoice', 'ppcp-vaulting-myaccount-payments', 'ppcp-gateway-settings', 'ppcp-webhooks-status-page', 'ppcp-tracking' ); | |
| return array_merge( $scripts, $scripts_to_exclude ); | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // removes PayPal smart buttons on single product page for bookable type products from WooCommerce Bookings plugin | |
| function ppcp_remove_single_product_buttons( $enable_button, $product ){ | |
| if ( $product->is_type( 'booking' ) ) { | |
| $enable_button = false; | |
| } | |
| return $enable_button; | |
| } | |
| add_action( 'woocommerce_paypal_payments_product_supports_payment_request_button', 'ppcp_remove_single_product_buttons', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function remove_ppcp_pui_for_products( $available_gateways ) { | |
| // Not in backend (admin) | |
| if( is_admin() ) | |
| return $available_gateways; | |
| // Set var default state |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('multilingualpress.metabox_after_relate_posts', function($context, $request) { | |
| // get post meta value from source site | |
| $sku = (string)$request->bodyValue( | |
| '_sku', | |
| INPUT_POST, | |
| FILTER_SANITIZE_STRING | |
| ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('ppcp_request_args', function ($args, $url){ | |
| if (strpos($url,'capture') !== false) { | |
| $args['headers']['PayPal-Mock-Response'] = '{"mock_application_codes": "INSTRUMENT_DECLINED"}'; | |
| } | |
| return $args; | |
| }, 10, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // removes PayPal smart buttons on single product page for a product with a given id | |
| function ppcp_remove_single_product_buttons() { | |
| $product = wc_get_product(); | |
| if ($product) { | |
| if ( $product->get_id() == 24 ) { | |
| return false; | |
| } | |
| else { return true;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function woocommerce_paypal_payments_card_button_gateway_icon( $icon, $id ) { | |
| if ( $id === 'ppcp-card-button-gateway' ) { | |
| return '<img src="https://upload.wikimedia.org/wikipedia/commons/2/2a/Mastercard-logo.svg" alt="Mastercard" /> <img src="https://upload.wikimedia.org/wikipedia/commons/0/04/Visa.svg" alt="Visa" /> <img src="https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-100px.png" alt="PayPal Payments" />'; | |
| } else { | |
| return $icon; | |
| } | |
| } | |
| add_filter( 'woocommerce_gateway_icon', 'woocommerce_paypal_payments_card_button_gateway_icon', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function add_ppcp_gateway_title_link( $title, $id ) { | |
| if ( 'ppcp-gateway' === $id ) { | |
| $title .= sprintf( ' <a href="%s" class="about_ppcp" onclick="javascript:window.open(\'%s\',\'WIPPcp\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700\'); return false;" title="What is PayPal?">What is PayPal?</a>', esc_url( 'https://www.paypal.com/us/webapps/mpp/paypal-popup' ), esc_url( 'https://www.paypal.com/us/webapps/mpp/paypal-popup' ) ); | |
| } | |
| return $title; | |
| } | |
| add_filter( 'woocommerce_gateway_title', 'add_ppcp_gateway_title_link', 10, 2 ); |