PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.5.7
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.5.7
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
sellkit / includes / elementor / modules / checkout / integrations / paypal-for-woocommerce.php

paypal-for-woocommerce.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.5.7, at includes/elementor/modules/checkout/integrations/paypal-for-woocommerce.php

79 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Elementor\Modules\Checkout\Integrations;
4
5 defined( 'ABSPATH' ) || die();
6
7 use Sellkit\Elementor\Modules\Checkout\Integrations\Integration;
8
9 /**
10 * Integration class to integrate paypal for WooCommerce gateway with sellkit checkout widget.
11 *
12 * @since 1.1.0
13 */
14 class Paypal_For_Woocommerce extends Integration {
15 /**
16 * Check requirement to enable gateway in sellkit checkout widget.
17 *
18 * @return bool
19 * @since 1.1.0
20 */
21 protected function requirements() {
22 // Plugin is not installed.
23 if ( ! class_exists( 'Angelleye_PayPal_Express_Checkout_Helper' ) ) {
24 return false;
25 }
26
27 $this->parent = \Angelleye_PayPal_Express_Checkout_Helper::instance();
28
29 // Gateway is not active.
30 if ( 'no' === $this->parent->enabled ) {
31 return false;
32 }
33
34 return true;
35 }
36
37 /**
38 * Content of express checkout methods.
39 *
40 * @return void
41 * @since 1.1.0
42 */
43 public function content() {
44
45 add_filter( 'angelleye_ec_checkout_page_buy_now_nutton', function( $button_output ) {
46 /* translators: %1$s: URL to paypal %2$s: paypal image src %3$s: image alt text */
47 $button = sprintf(
48 '<div id="paypal_ec_button">
49 <a class="paypal_checkout_button" href="%1$s">
50 <img src="%2$s" class="ec_checkout_page_button_type_paypalimage" border="0" alt="%3$s" />
51 </a>
52 </div>',
53 esc_url( add_query_arg( 'pp_action', 'set_express_checkout', untrailingslashit( WC()->api_request_url( 'WC_Gateway_PayPal_Express_AngellEYE' ) ) ) ),
54 \WC_Gateway_PayPal_Express_AngellEYE::angelleye_get_paypalimage(),
55 esc_html__( 'Pay with PayPal', 'paypal-for-woocommerce' )
56 );
57
58 return $button;
59 } );
60
61 ob_start();
62 $button = '';
63 echo apply_filters( 'angelleye_ec_checkout_page_buy_now_nutton', $button );
64 echo ob_get_clean();
65 }
66
67 /**
68 * Hooks to integrate current gateway with sellkit checkout widget.
69 *
70 * @return void
71 * @since 1.1.0
72 */
73 public function hooks() {
74 remove_action( 'woocommerce_before_checkout_form', [ $this->parent, 'checkout_message' ], 5 );
75 remove_action( 'woocommerce_before_checkout_billing_form', [ $this->parent, 'ec_formatted_billing_address' ], 9 );
76 remove_action( 'woocommerce_before_checkout_shipping_form', [ $this->parent, 'angelleye_shipping_sec_title' ], 5 );
77 }
78 }
79