Some formulas have some common parts, so it’s interesting to have those parts saved into php files and use them in several products.

CFO supports “PHP includes”, so it’s as easy as making a folder in your server, save your include-files there and then include them into your formulas like this example.

Take a look at “getcwd()” PHP function, it’s interesting to make sure you are accessing the right folder, we have made this example to show how to detect it and then how to inspect if it is correct with CFO_InspectVariable()

Remember to use variables into your formulas because product_id could change from one product to other, read this article.

// Locate this script
$ThisScriptLocated = getcwd();
CFO_InspectVariable($ThisScriptLocated, "Where is located this script");

// Include the include file
$MyIncludeScript = $ThisScriptLocated . "/_DummyCFOInclude/HiCFOInclude.php";
	* HiCFOInclude.php CONTENTS *
	// Hi!, I am an include
	// Dummy price assigned, only to see how to include
	$FinalPrice = 6

// Debug

You can visit this demo in our Demo Store