diff --git a/Makefile b/Makefile index 546315c..284c43f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION := 3.31.0 +VERSION := 3.31.1 PLUGINSLUG := woocart-defaults SRCPATH := $(shell pwd)/src diff --git a/src/classes/GDPR.php b/src/classes/GDPR.php index b0b945f..5c774e7 100644 --- a/src/classes/GDPR.php +++ b/src/classes/GDPR.php @@ -416,6 +416,10 @@ public function options_page() { * @return null */ public function scripts() { + $consent = get_option( 'woocommerce_allow_tracking', 'no' ); + if ( 'no' !== $consent ) { + return; + } $plugin_dir = plugin_dir_url( dirname( __FILE__ ) ); wp_enqueue_style( 'woocart-gdpr', "{$plugin_dir}assets/css/front-gdpr.css", array(), Release::Version ); diff --git a/tests/GdprTest.php b/tests/GdprTest.php index 2adc9e7..2d9354d 100644 --- a/tests/GdprTest.php +++ b/tests/GdprTest.php @@ -27,28 +27,11 @@ function tearDown() : void { * @covers ::scripts */ public function testConstructor() { - \WP_Mock::userFunction( - 'plugin_dir_url', - array( - 'times' => 1, - ) - ); - \WP_Mock::userFunction( - 'wp_enqueue_style', - array( - 'times' => 1, - ) - ); - \WP_Mock::userFunction( - 'wp_enqueue_script', - array( - 'times' => 1, - ) - ); + \WP_Mock::userFunction( 'get_option', array( - 'times' => 2, + 'times' => 3, 'return' => 'yes', ) );