Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to override woocommerce_cart_tab_button in cart_tab_templates.php #53

Open
asifmohtesham opened this issue Sep 25, 2018 · 1 comment

Comments

@asifmohtesham
Copy link

asifmohtesham commented Sep 25, 2018

Hi, Koster!

Edit: Same with class-cart-tab-frontend.php.

I am having a bit of difficulty overriding the default woocommerce_cart_tab_button function.

Fatal error: Cannot redeclare woocommerce_cart_tab_button() (previously declared in C:\path\wp-content\plugins\woocommerce-cart-tab\includes\cart-tab-templates.php:9) in C:\path_to_theme\cart_tab_customisations.php on line 3

It is rather perplexing because you've wrapped the function in discussion inside of the function_exists clause. It should have overridden the default function, but instead I am hit with the error above. I have had no problems overriding the default WordPress or even WooCommerce functions using the same technique.

Let me know if you need additional details. Any help would be appreciated. Thanks!

@jameskoster
Copy link
Owner

Hmm, perhaps you're redeclaring after the original function is defined? I think themes are loaded after plugins. Try wrapping your new declaration inside a separate function hooked into init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants