• Any WordPress Woocommerce experts out here?

    I’m trying to solve a problem. I want to add a PHP Include to a description field in a Woocommerce product so that I don’t have to change the wording on every single product… but rather I can just change the one file and have it reflect that change in every product instantly.

    <?php include("http://skullvault.com/product_disclaimer.php") ?>

    But, Woocommerce won’t display the content of that PHP file.

    Anybody know how to override Woocommerce like this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try making your own shortcode. So your description might contain: [disclaimer]

    To give effect to the shortcode, you will need some lines in functions.php of your child theme:

    add_shortcode( 'disclaimer', 'disclaimer' );
    function disclaimer() {
      $html = '<p>stuff ...';
      $html .= 'more stuff ... </p>'
      return $html;
    }
    

    Passing parameters in the shortcode is possible with more effort.

    Thread Starter lumdingo

    (@lumdingo)

    Thank you. I am new to this, so I’ll have to figure out how to add to the functions.php file. I’m not a PHP coder, so this should be fun.

    This is already a huge help. Thank you.

    Thread Starter lumdingo

    (@lumdingo)

    I just found this. It might be what I’m looking for.

    https://wordpress.org/plugins/blocks/

    • This reply was modified 9 years, 3 months ago by lumdingo.
    Thread Starter lumdingo

    (@lumdingo)

    IT WORKS!!! Yes!! So relieved.

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

The topic ‘Adding PHP Includes to Woocomerce Description Fields’ is closed to new replies.