diff --git a/includes/class-modal-checkout.php b/includes/class-modal-checkout.php index 64e915744..cf76a0131 100644 --- a/includes/class-modal-checkout.php +++ b/includes/class-modal-checkout.php @@ -40,17 +40,19 @@ public static function init() { add_filter( 'woocommerce_get_return_url', [ __CLASS__, 'woocommerce_get_return_url' ], 10, 2 ); add_filter( 'woocommerce_get_checkout_order_received_url', [ __CLASS__, 'woocommerce_get_return_url' ], 10, 2 ); add_filter( 'wc_get_template', [ __CLASS__, 'wc_get_template' ], 10, 2 ); - add_filter( 'woocommerce_checkout_get_value', [ __CLASS__, 'woocommerce_checkout_get_value' ], 10, 2 ); add_filter( 'woocommerce_checkout_fields', [ __CLASS__, 'woocommerce_checkout_fields' ] ); - add_filter( 'woocommerce_update_order_review_fragments', [ __CLASS__, 'order_review_fragments' ] ); add_filter( 'woocommerce_payment_successful_result', [ __CLASS__, 'woocommerce_payment_successful_result' ] ); add_action( 'woocommerce_checkout_create_order_line_item', [ __CLASS__, 'woocommerce_checkout_create_order_line_item' ], 10, 4 ); add_filter( 'newspack_donations_cart_item_data', [ __CLASS__, 'amend_cart_item_data' ] ); add_filter( 'newspack_recaptcha_verify_captcha', [ __CLASS__, 'recaptcha_verify_captcha' ], 10, 2 ); add_filter( 'woocommerce_enqueue_styles', [ __CLASS__, 'dequeue_woocommerce_styles' ] ); - add_filter( 'wcs_place_subscription_order_text', [ __CLASS__, 'order_button_text' ], 1 ); - add_filter( 'woocommerce_order_button_text', [ __CLASS__, 'order_button_text' ] ); - add_filter( 'option_woocommerce_subscriptions_order_button_text', [ __CLASS__, 'order_button_text' ] ); + add_filter( 'wcs_place_subscription_order_text', [ __CLASS__, 'order_button_text' ], 5 ); + add_filter( 'woocommerce_order_button_text', [ __CLASS__, 'order_button_text' ], 5 ); + add_filter( 'option_woocommerce_subscriptions_order_button_text', [ __CLASS__, 'order_button_text' ], 5 ); + add_action( 'woocommerce_before_checkout_form', [ __CLASS__, 'render_before_checkout_form' ] ); + add_action( 'woocommerce_checkout_before_customer_details', [ __CLASS__, 'render_before_customer_details' ] ); + add_action( 'woocommerce_checkout_before_terms_and_conditions', [ __CLASS__, 'render_before_terms_and_conditions' ] ); + add_filter( 'woocommerce_enable_order_notes_field', [ __CLASS__, 'enable_order_notes_field' ] ); // Remove some stuff from the modal checkout page. It's displayed in an iframe, so it should not be treated as a separate page. add_action( 'wp_enqueue_scripts', [ __CLASS__, 'dequeue_scripts' ], 11 ); @@ -136,7 +138,7 @@ public static function woocommerce_payment_successful_result( $result ) { * @param array $enqueue_styles Array of styles to enqueue. */ public static function dequeue_woocommerce_styles( $enqueue_styles ) { - if ( ! isset( $_REQUEST['modal_checkout'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended + if ( ! self::is_modal_checkout() ) { return $enqueue_styles; } unset( $enqueue_styles['woocommerce-general'] ); @@ -275,18 +277,29 @@ public static function render_modal_markup() { if ( ! self::$has_modal ) { return; } + /** + * Filters the header title for the modal checkout. + * + * @param string $title The title. + */ + $title = apply_filters( 'newspack_blocks_modal_checkout_title', __( 'Complete your transaction', 'newspack-blocks' ) ); ?> -