Skip to content

Instantly share code, notes, and snippets.

Last active August 28, 2023 14:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
CheckoutWC AB testing example
* The following code MUST be deployed in an MU plugin to work
add_action( 'cfw_init_ab_tests', function() {
cfw_register_ab_test( 'cfw_disabled', 'example_set_cfw_disabled' );
// To enable the test progamatically, you would use this call:
cfw_activate_ab_test( 'cfw_disabled' );
// Note: This would activate it for all visitors. To selectively activate, see the URL loading option below
} );
function example_set_cfw_disabled() {
cfw_add_setting_value_override( 'enabled', 'no' );
// cfw_add_setting_value_override( 'anothersetting', 'anothervalue' );
* URL loading example
* Load a test with a special URL parameter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment