Tweak terms template to check the woocommerce_shortcode is not present in the content.

This commit is contained in:
Mike Jolley 2017-07-04 14:03:08 +01:00
parent 02ffdaf8f5
commit 671f052641
3 changed files with 10 additions and 7 deletions

View File

@ -616,8 +616,10 @@ jQuery( function( $ ) {
},
toggle_terms: function() {
$( '.woocommerce-terms-and-conditions' ).slideToggle();
return false;
if ( $( '.woocommerce-terms-and-conditions' ).length ) {
$( '.woocommerce-terms-and-conditions' ).slideToggle();
return false;
}
}
};

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.1.0
* @version 3.1.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
@ -14,11 +14,12 @@ $terms_page_id = wc_get_page_id( 'terms' );
if ( $terms_page_id > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) :
$terms = get_post( $terms_page_id );
$terms_content = wc_format_content( $terms->post_content );
?>
<?php
$terms_content = has_shortcode( $terms->post_content, 'woocommerce_checkout' ) ? '' : wc_format_content( $terms->post_content );
if ( $terms_content ) {
do_action( 'woocommerce_checkout_before_terms_and_conditions' );
echo '<div class="woocommerce-terms-and-conditions" style="display: none; max-height: 200px; overflow: auto;">' . $terms_content . '</div>';
}
?>
<p class="form-row terms wc-terms-and-conditions">
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">