Skip to content

Commit

Permalink
Gate block templates feature for WC 6.0.0 (woocommerce#5210)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcafferkey authored and jonny-bull committed Dec 14, 2021
1 parent 5e16467 commit bb6f752
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/BlockTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ class BlockTemplatesController {
* Constructor.
*/
public function __construct() {
$this->templates_directory = plugin_dir_path( __DIR__ ) . 'templates/' . self::TEMPLATES_DIR_NAME;
$this->template_parts_directory = plugin_dir_path( __DIR__ ) . 'templates/' . self::TEMPLATE_PARTS_DIR_NAME;
$this->init();
// This feature is gated for WooCommerce versions 6.0.0 and above.
if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '6.0.0', '>=' ) ) {
$this->templates_directory = plugin_dir_path( __DIR__ ) . 'templates/' . self::TEMPLATES_DIR_NAME;
$this->template_parts_directory = plugin_dir_path( __DIR__ ) . 'templates/' . self::TEMPLATE_PARTS_DIR_NAME;
$this->init();
}
}

/**
Expand Down

0 comments on commit bb6f752

Please sign in to comment.