Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active September 7, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/b86c9110f5ef87ce0ad2e51cf7a86a34 to your computer and use it in GitHub Desktop.
Save Shelob9/b86c9110f5ef87ce0ad2e51cf7a86a34 to your computer and use it in GitHub Desktop.
Example code for using the cf_brain_tree_load_dependencies to prevent BrainTree SDK conflicts with other plugins including WooCommerce
<?php
/**
* If WooCommerce BrainTree is active, use WooCommerce's copy of BrainTree SDK instead of Caldera Forms'
*
* If using WooCommerce Braintree v1 - use this revision https://gist.github.com/Shelob9/b86c9110f5ef87ce0ad2e51cf7a86a34/revisions
*/
add_action( 'init', function(){
if( ! class_exists( 'WC_Braintree' ) ){
return;
}
/**
* Prevent Caldera Forms BrainTree from loading its dependencies, including the BrainTree PHP SDK
*/
add_filter( 'cf_brain_tree_load_dependencies', '__return_false' );
});
<?php
/**
* Prevent Caldera Forms BrainTree from loading its dependencies, including the BrainTree PHP SDK
*/
add_filter( 'cf_brain_tree_load_dependencies', '__return_false' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment