Home Forums WoodMart support forum hello i use WoodMart theme but error! Reply To: hello i use WoodMart theme but error!

#135689

Artem Temos
Keymaster

Thank you very much. By default, WooCommerce doesn’t support shortcodes in terms and conditions area. We suggest you to create a separate page for that and use only plain text there. It would be much easier and that area doesn’t need a lot of texts.

As an alternative, you can try to add the following code snippet to the functions.php file in your child theme and enable shortcodes there

/*** Strip Shortcode from Terms & Conditions Box *****/
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 );
add_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content_custom', 30 );
function wc_terms_and_conditions_page_content_custom() {
	$terms_page_id = wc_terms_and_conditions_page_id();
	if ( ! $terms_page_id ) {
		return;
	}
	$page = get_post( $terms_page_id );
	if ( $page && 'publish' === $page->post_status && $page->post_content && ! has_shortcode( $page->post_content, 'woocommerce_checkout' )) {
echo '<div class="woocommerce-terms-and-conditions" style="display: none; max-height: 200px; overflow: auto;">' . wp_kses_post( wc_format_content(preg_replace( "~(?:\[/?)[^/\]]+/?\]~s", '', $page->post_content ) ) ) . '</div>';}
}