• Resolved Erfan MHDi

    (@erfanmhd)


    hello,
    i’d like to get a list of all assets that plugin is loading css, js …
    so i can remove some of them from loading into pages.

    i’ve tried this :

    
    function yith_wcwl_remove_awesome_stylesheet() {
    	wp_deregister_style( 'yith-wcwl-font-awesome' );
    }
    add_action( 'wp_enqueue_scripts', 'yith_wcwl_remove_awesome_stylesheet', 9999 );
    

    but it’s not preventing font-awesome from loading !
    can i have a solution to prevent all of plugin assets from loading ?!

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Erfan MHDi

    (@erfanmhd)

    i’ve found this line of codes to do this:

    function yith_wcwl_selectively_dequeue_assets() {
    
    	// dequeue assets
    	wp_dequeue_style( 'jquery-selectBox' );
    	wp_dequeue_style( 'yith-wcwl-font-awesome' );
    	wp_dequeue_style( 'yith-wcwl-main' );
    	wp_dequeue_style( 'yith-wcwl-theme' );
    
    	// dequeue scripts
    	wp_dequeue_script( 'jquery-selectBox' );
    	//wp_dequeue_script( 'jquery-yith-wcwl' );
    }
    add_action( 'wp_enqueue_scripts', 'yith_wcwl_selectively_dequeue_assets', 99 );
    

    it’s working now, but the problem is it looks like the jquery-yith-wcwl is loading jquery-selectBox too.

    when i uncomment the wp_dequeue_script( 'jquery-yith-wcwl' ); line both jquery-selectBox and jquery-yith-wcwl will be removed but when i comment or remove this line : wp_dequeue_script( 'jquery-yith-wcwl' ); although i have wp_dequeue_script( 'jquery-selectBox' ); but jquery-selectBox is still loading in my pages.

    how can i remove jquery-selectBox but keep jquery-yith-wcwl in page ?

    Thanks.

    Plugin Support Antonio La Rocca

    (@therock130)

    Hi there

    selectbox is a required dependency of main wishlist plugin, so I don’t recommend removing it
    Anyway, if you want to proceed this way, I suggest you to remove dependency from main script using the following PHP code

    add_filter( 'yith_wcwl_main_script_deps', function( $deps ) {
    	unset( $deps[1] );
    	
    	return $deps;
    }, 10, 1 );
    Thread Starter Erfan MHDi

    (@erfanmhd)

    Thanks for your response ??

    Plugin Support Antonio La Rocca

    (@therock130)

    You’re welcome

    We are doing our best to improve our plugins. Our target is to develop and release the best free plugins for WooCommerce, but to achieve this we need your help. Please leave a good review to support us and help our growth

    Hi,

    When I try to remove font-awesome deps it’s not working. Can you assist what might be wrong?

    function arendelle_dequeue_yith_wcwl_font_awesome_styles( $deps ) {
      $deps = array( 'jquery-selectBox' );
      return $deps;
    }
    add_filter( 'yith_wcwl_main_style_deps', 'arendelle_dequeue_yith_wcwl_font_awesome_styles' );
    Plugin Support Antonio La Rocca

    (@therock130)

    Hi @deothemes

    You’re right, it seems that even if we provide filters to modify asset dependencies, then we just statically include all resources we need, thus making filters superfluous

    I’ll fix this issue in next relaese; if you want to test my changes right now, all you have to do is to download attached file, and repalce it in plugin’s directory, under wp-content/plugins/yith-woocommerce-wishlist-premium/includes/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove Plugin Assets’ is closed to new replies.