@@ 525-557 (lines=33) @@ | ||
522 | * @since 4.0.0 |
|
523 | * @version 4.0.0 |
|
524 | */ |
|
525 | public function display_payment_request_button_html() { |
|
526 | global $post; |
|
527 | ||
528 | $gateways = WC()->payment_gateways->get_available_payment_gateways(); |
|
529 | ||
530 | if ( ! isset( $gateways['stripe'] ) ) { |
|
531 | return; |
|
532 | } |
|
533 | ||
534 | if ( ! is_cart() && ! is_checkout() && ! is_product() && ! isset( $_GET['pay_for_order'] ) ) { |
|
535 | return; |
|
536 | } |
|
537 | ||
538 | if ( is_checkout() && ! apply_filters( 'wc_stripe_show_payment_request_on_checkout', false, $post ) ) { |
|
539 | return; |
|
540 | } |
|
541 | ||
542 | if ( is_product() && ! $this->should_show_payment_button_on_product_page() ) { |
|
543 | return; |
|
544 | } else { |
|
545 | if ( ! $this->allowed_items_in_cart() ) { |
|
546 | WC_Stripe_Logger::log( 'Items in the cart has unsupported product type ( Payment Request button disabled )' ); |
|
547 | return; |
|
548 | } |
|
549 | } |
|
550 | ?> |
|
551 | <div id="wc-stripe-payment-request-wrapper" style="clear:both;padding-top:1.5em;display:none;"> |
|
552 | <div id="wc-stripe-payment-request-button"> |
|
553 | <!-- A Stripe Element will be inserted here. --> |
|
554 | </div> |
|
555 | </div> |
|
556 | <?php |
|
557 | } |
|
558 | ||
559 | /** |
|
560 | * Display payment request button separator. |
|
@@ 565-593 (lines=29) @@ | ||
562 | * @since 4.0.0 |
|
563 | * @version 4.0.0 |
|
564 | */ |
|
565 | public function display_payment_request_button_separator_html() { |
|
566 | global $post; |
|
567 | ||
568 | $gateways = WC()->payment_gateways->get_available_payment_gateways(); |
|
569 | ||
570 | if ( ! isset( $gateways['stripe'] ) ) { |
|
571 | return; |
|
572 | } |
|
573 | ||
574 | if ( ! is_cart() && ! is_checkout() && ! is_product() && ! isset( $_GET['pay_for_order'] ) ) { |
|
575 | return; |
|
576 | } |
|
577 | ||
578 | if ( is_checkout() && ! apply_filters( 'wc_stripe_show_payment_request_on_checkout', false, $post ) ) { |
|
579 | return; |
|
580 | } |
|
581 | ||
582 | if ( is_product() && ! $this->should_show_payment_button_on_product_page() ) { |
|
583 | return; |
|
584 | } else { |
|
585 | if ( ! $this->allowed_items_in_cart() ) { |
|
586 | WC_Stripe_Logger::log( 'Items in the cart has unsupported product type ( Payment Request button disabled )' ); |
|
587 | return; |
|
588 | } |
|
589 | } |
|
590 | ?> |
|
591 | <p id="wc-stripe-payment-request-button-separator" style="margin-top:1.5em;text-align:center;display:none;">— <?php esc_html_e( 'OR', 'woocommerce-gateway-stripe' ); ?> —</p> |
|
592 | <?php |
|
593 | } |
|
594 | ||
595 | /** |
|
596 | * Whether payment button html should be rendered |