Home Forums WoodMart support forum Help! shortcodes visible in terms and conditions :(

Help! shortcodes visible in terms and conditions :(

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #192620

    Hello! I love the woodmart theme, I think it’s one of the best-looking and best-coded themes on themeforest 🙂

    I’m having a big problem though, on the checkout page, Woocommerce for some reason displays the terms and conditions inline, without any regard for WPBakery shortcodes.
    Because I’ve built the terms and conditions page using Woodmart shortcodes in the Back-end editor, users are now seeing a big blob of vc shortcodes, including [vc_row][vc_column], etc when they click the terms and conditions link.

    Please, please, help me find a solution to this problem.

    I do know how to program a bit, just need a point in the right direction.

    I know it’s probably an issue between woocommerce and visual composer, but woodmart is built upon both of these and should work and look flawlessly with both, and Terms and conditions are a very important part of running an online shop.

    Thank you very much for your help!
    Cheers

    #192637

    Hello,

    By default, WooCommerce doesn’t support shortcodes in terms and conditions. We suggest you 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.

    Best Regards.

    #192791

    Hello Aizaz.
    Thanks for your suggestion, unfortunately we are required by EU law to show the complete terms and conditions and it is a giant blob of ugly text, that is why we need to style it with the shortcodes. Maintaining two different versions is also not a good solution for us.

    Since Woodmart theme already has great support for popups (promo and newsletter popup, product quick view) it would be the most elegant solution to use the theme’s functionality. I just need to know how to implement it.

    Can you please point me in the right direction – I would just like to have the terms link open the ToS page content in a modal popup window. I can also put the TOS content in a HTML Block if that would make things easier.

    Is it possible by adding a popup class to the ToS link in the terms.php template file? Or maybe by adding some jQuery code for the ToS link in woodmart custom JS?

    There must be some existing theme functionality that I can use to open the link in a modal window…

    Thanks in advance for your help!

    #192969

    Hello,

    You can try adding the following code in your child theme functions.php file to enable shortcode in the area.

    /*** 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>';}
    }

    Best Regards.

Viewing 4 posts - 1 through 4 (of 4 total)