Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created December 7, 2016 16:17
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 tommcfarlin/d1edffb9acf3ee3339835a71cd440958 to your computer and use it in GitHub Desktop.
Save tommcfarlin/d1edffb9acf3ee3339835a71cd440958 to your computer and use it in GitHub Desktop.
[WordPress] WooCommerce Integrations with WordPress Namespaces
<?php
namespace Acme\Inc\Integration;
class Acme_Integration_Bootstrap {
public function init() {
if ( class_exists( 'WC_Integration' ) ) {
include_once 'class-acme-integration.php';
add_filter(
'woocommerce_integrations',
array( $this, 'add_integration' )
);
}
}
public function add_integration( $integrations ) {
// Notice that you must provide the fully-qualified class name.
$integrations[] = 'Acme\\Inc\\Integration\\Acme_Integration';
return $integrations;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment