diff --git a/inc/main.php b/inc/main.php index 53f9663..9686c1c 100644 --- a/inc/main.php +++ b/inc/main.php @@ -62,10 +62,7 @@ function gtmkit_plugin_activation(): void { function gtmkit_plugin_deactivation(): void { if ( function_exists( 'wp_set_option_autoload' ) ) { - wp_set_option_autoload( 'gtmkit', true ); - } else { - global $wpdb; - $wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'gtmkit'" ); + wp_set_option_autoload( 'gtmkit', false ); } wp_clear_scheduled_hook( 'gtmkit_send_anonymous_data' ); diff --git a/src/Installation/Activation.php b/src/Installation/Activation.php index 9d143f5..51410a2 100644 --- a/src/Installation/Activation.php +++ b/src/Installation/Activation.php @@ -63,9 +63,6 @@ public function set_autoload_on_options(): void { if ( function_exists( 'wp_set_option_autoload' ) ) { wp_set_option_autoload( 'gtmkit', true ); - } else { - global $wpdb; - $wpdb->query( "UPDATE $wpdb->options SET autoload = 'yes' WHERE option_name = 'gtmkit'" ); } } } diff --git a/src/Integration/WooCommerce.php b/src/Integration/WooCommerce.php index 16e5ba4..7e6ba53 100644 --- a/src/Integration/WooCommerce.php +++ b/src/Integration/WooCommerce.php @@ -1027,28 +1027,11 @@ public function cart_item_remove_link( string $woocommerce_cart_item_remove_link 'remove_from_cart' ); - if ( class_exists( 'WP_HTML_Tag_Processor' ) ) { - $link_html = new \WP_HTML_Tag_Processor( $woocommerce_cart_item_remove_link ); - $link_html->next_tag(); - $link_html->set_attribute( 'data-gtmkit_product_data', esc_attr( wp_json_encode( $item_data ) ) ); - $woocommerce_cart_item_remove_link = $link_html->get_updated_html(); - } else { - $find_href = ' href="'; - $replace_width_product_data = sprintf( ' data-gtmkit_product_data="%s" href="', esc_attr( wp_json_encode( $item_data ) ) ); - - $substring_pos = strpos( $woocommerce_cart_item_remove_link, $find_href ); - - if ( $substring_pos !== false ) { - $woocommerce_cart_item_remove_link = substr_replace( - $woocommerce_cart_item_remove_link, - $replace_width_product_data, - $substring_pos, - strlen( $find_href ) - ); - } - } + $link_html = new \WP_HTML_Tag_Processor( $woocommerce_cart_item_remove_link ); + $link_html->next_tag(); + $link_html->set_attribute( 'data-gtmkit_product_data', esc_attr( wp_json_encode( $item_data ) ) ); - return $woocommerce_cart_item_remove_link; + return $link_html->get_updated_html(); } /**