I wrote this code and tested it, it worked properly.
In this code, I first check the post ID, whether page or post or any other type of post.
Then I disable all plugin styles and scripts and delete the class that is attached to the body
Finally, I remove a new element created in a class to display the plugin root.
Put this code in the functions.php file
function disble_shopwp_pages()
{
$post_id_array = array(
218, 433, 71, 2066, 825, 825, 7, 2009, 420
);
if (in_array(get_the_ID(), $post_id_array)) {
return true;
}
}
function remove_wpshopify()
{
if (disble_shopwp_pages()):
wp_dequeue_style('shopwp-styles-frontend-all');
wp_deregister_style('shopwp-styles-frontend-all');
wp_dequeue_script('shopwp-runtime');
wp_dequeue_script('shopwp-vendors-public');
wp_dequeue_script('shopwp-public');
endif;
}
add_action('wp_enqueue_scripts', 'remove_wpshopify', 9999);
function wpshopify_body_class($classes)
{
if (disble_shopwp_pages()) {
unset($classes[array_search('shopwp', $classes)]);
}
return $classes;
}
add_filter('body_class', 'wpshopify_body_class', 999, 2);
function remove_shopwp_root_elements()
{
if (disble_shopwp_pages()) {
echo '<script>
jQuery(document).ready(function () {
jQuery("#shopwp-root").remove();
});
</script>';
}
}
add_action('wp_footer', 'remove_shopwp_root_elements');