Advertisement
Barbareshet

woocommerce/checkout/terms.php

Jul 2nd, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3.     exit;
  4. }
  5. $toc_text = get_field('sa_toc_text', 'option');//using ACF Field
  6. $toc_default = 'I&rsquo;ve read and accept the terms &amp; conditions';//Default
  7. $terms_page_id = wc_get_page_id( 'terms' );
  8.  
  9. if ( $terms_page_id > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) :
  10.     $terms         = get_post( $terms_page_id );
  11.     $terms_content = has_shortcode( $terms->post_content, 'woocommerce_checkout' ) ? '' : wc_format_content( $terms->post_content );
  12.  
  13.     if ( $terms_content ) {
  14.         do_action( 'woocommerce_checkout_before_terms_and_conditions' );
  15.         echo '<div class="woocommerce-terms-and-conditions" style="display: none; max-height: 200px; overflow: auto;">' . $terms_content . '</div>';
  16.     }
  17.     ?>
  18.     <p class="form-row terms wc-terms-and-conditions">
  19.         <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
  20.             <input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="terms" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) ), true ); ?> id="terms" /> <span><?php printf( __( '<a href="%1$s" target="_blank" class="woocommerce-terms-and-conditions-link">%2$s</a>', 'woocommerce' ), esc_url( wc_get_page_permalink( 'terms' ) ), $toc_text ? $toc_text : $toc_default ); ?></span> <span class="required">*</span>
  21.         </label>
  22.         <input type="hidden" name="terms-field" value="1" />
  23.     </p>
  24.     <?php do_action( 'woocommerce_checkout_after_terms_and_conditions' ); ?>
  25. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement