New tab for terms and conditions

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1117939
    Rachel Brown
    Participant

    My client would like the terms and conditions to open in a new tab rather than opening in the checkout page. How can I achieve this? Thanks!

    #1119720
    Rachel Brown
    Participant

    It’s been days since I asked this question, and my client would appreciate an update on this issue. Thanks!

    #1119768
    Andre Flores
    Moderator

    Hello Rachel,

    You will need to override default Terms & Conditions section function. In order to do that add the following code to your child theme functions.php file:

    add_action( 'wp_head', 'remove_renderTermsAndConditions' );
    function remove_renderTermsAndConditions(){
    	remove_action( 'mphb_sc_checkout_form', array( '\MPHB\Views\Shortcodes\CheckoutView', 'renderTermsAndConditions' ), 60 );
    }
    
    add_action( 'mphb_sc_checkout_form', 'custom_renderTermsAndConditions', 60 );
    
    function custom_renderTermsAndConditions(){
    		$termsPageId = MPHB()->settings()->pages()->getTermsAndConditionsPageId();
    		$termsHtml   = MPHB()->settings()->main()->getTermsAndConditionsText();
    
    		if ( !empty( $termsHtml ) ) {
    			?>
    			<section class="mphb-checkout-terms-wrapper mphb-checkout-section">
    				<div class="mphb-terms-and-conditions">
    					<?php echo $termsHtml; ?>
    				</div>
    				<p class="mphb-terms-and-conditions-accept">
    					<label>
    						<input type="checkbox" id="mphb_accept_terms" name="mphb_accept_terms" value="1" required="required" />
    						<?php
    							$termsPageUrl  = get_permalink( $termsPageId );
    							$termsPagelink = '<a class="mphb-terms-and-conditions-link-theme" href="' . esc_url( $termsPageUrl ) . '" target="_blank">' . _x( 'terms & conditions', 'I\'ve read and accept the terms & conditions', 'motopress-hotel-booking' ) . '</a>';
    
    							printf( _x( 'I\'ve read and accept the %s', 'I\'ve read and accept the <tag>terms & conditions</tag>', 'motopress-hotel-booking' ), $termsPagelink );
    						?>
    						<abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr>
    					</label>
    				</p>
    			</section>
    			<?php
    		}
    	}

    Regards,
    Andre

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.