Closed mukundthanki closed 9 years ago
I'm not Mark, but here's my response to this.
You're trying to achieve something which, by design, the dependencies API won't let you do. The wc-checkout
script depends on wc-address-i18n
. If you dequeue wc-address-i18n
then wc-checkout
is likely to break. This is why wc-checkout
has marked it as a dependency.
The dependencies API prevents this breakage by dequeueing any scripts which depend on a script which isn't available.
You should be thinking about why you want to dequeue wc-address-i18n
. There is probably a better way of addressing whatever issue it is you're having with this script.
What you could do is this: enqueue the dependency separately (or wait for something else to enqueue it, or not). And then enqueue your dependent script late, but check to see if the dependency is enqueued. Leave it out, if not.
But I would question why you need to do this. If your script can work with or without the dependency, can't you just make the JS do the test for the dependency?
Hi Mark,
To make clear my query I would like to show my use case here
Here is snippet from WooCommerce plugin which loads several scripts like this way.
I want to dequeue
wc-address-i18n
so, I try to hook my function atwp_print_scripts
and try to deregister it, but it also dequeuewc-checkout
, which I dont want to dequeue,I think its because of dependencies. Can we just manipulate only dependencies array ? I think it would be great if we can change dependencies and it should not affect enqueue script.
Can you please suggest me how can I solve this issue ? If its default functionality or something else ?
I have not approached WooCommerce makers, If its default then I need to approach WooCommerce.