VC elements appear in terms & condition section of checkout page
-
Hello,
Does anyone have an idea on how to remove the vc elements / shortcodes from the terms & condition section in the checkout page?
I have tried creating a terms page without using any vc elements / textblock etc. but then some style/css of ie h4 tags does not work.
Brgds
Rune
I have found a solution for this problem unless you have anything better.
Here is my solution which is added to child-theme functions:
// Remove shortcode tags from WC terms and conditions in checkout page
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", '', do_shortcode('[html_block id="20133"]') ) ) ) . '</div>';
}
}
As i am using HTML blocks for the terms and conditions you will see in code that i call the block using shortcode. To call the page content directly just replace
do_shortcode('[html_block id="20133"]')
with this:
$page->post_content
Brgds
Rune
Hello,
Just switch the page into the WordPress default mode and insert the Privacy text. Woocommerce pages do not support WP Bakery page builder.
Best Regards
If doing so we get issues with the style h2, h3, h4 and paragraphs has no style and text no line breaks so the text get all messed together. So the only way to get a perfect content is by using VC elements textblock and then the code in my previos message.
Rune
Hello,
In this case, apply the code.
Best Regards