Add woocommerce js and css to main

hi,

i am using woocommerce which insert a lot of css and js to the html and i would like to use sage power and insert all those css and js to main css/js.

so i remove all woocommerce css and js with:
add_filter( ‘woocommerce_enqueue_styles’, ‘__return_empty_array’ );

and than i added to manifest.json the paths in vendors like:
“vendor”: [
"…/…/plugins/woocommerce/assets/js/prettyPhoto/jquery.prettyPhoto.js",
"…/…/plugins/woocommerce/assets/js/prettyPhoto/jquery.prettyPhoto.init.js"
],

but i had 2 problems:

  1. woocommerce call to one of the css files only on mobile width and it doest it with a php if statement. i wonder if i can implement this logic with the manifest?

  2. woocommerce alse injected some “cdata” scripts. can i insert them also to the manifest in some way?

thanks in advanced,
daniel

anyone? please? :sob:

I’m not aware of a way to do this with the manifest.json file. Is this a huge file or something? I wonder why it can’t be included in a single css file with media queries…

This would depend on how Woocommerce outputs the code, so you would have to check their source code.

thanks for your help,

it seems it is done with wp_localize_script. do you think there is a way to win this?

anyone? please? :sob:

You’re not going to get localized/inline JS moved into the compiled assets.