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

Custom folder in child theme should be recognised whether named WC or CC #167

Closed
ghost opened this issue Jan 9, 2020 · 4 comments · Fixed by #169
Closed

Custom folder in child theme should be recognised whether named WC or CC #167

ghost opened this issue Jan 9, 2020 · 4 comments · Fixed by #169
Assignees
Labels
Has PR Issue has a PR.
Milestone

Comments

@ghost
Copy link

ghost commented Jan 9, 2020

Describe the current situation
An existing site may have a woocommerce folder set up in a child theme for custom versions of some of the files. If this is changed to be named classic-commerce it is not recognised. So this folder currently still needs to be called woocommerce, even when using CC.

Additional context
It's a good idea that the woocommerce folder is recognised so as not to break existing sites that already have this folder in place. But anyone setting it up from scratch would probably call it classic-commerce. Can it be set up to to recognise either of them?

@timbocode timbocode added this to the 1.0.0-alpha3 milestone Jan 10, 2020
@timbocode timbocode self-assigned this Jan 10, 2020
@timbocode
Copy link
Contributor

This requires a small change to function template_path() in includes/class-woocommerce.php as shown in this gist:

https://gist.github.com/timbocode/62b21ea425a48375ea4db2e94b6eba40

This will first look for the existence of directory theme-name/classic-commerce. If that exists, it is set as the template path ( WC()->template_path() ). If theme-name/woocommerce exists, it is ignored.

If theme-name/classic-commerce does not exist, theme-name/woocommerce is set as the template path if it exists.

This does mean that the user cannot have both theme-name/classic-commerce and theme-name/woocommerce in use at the same time but I personally think that's best anyway otherwise things could get a tad messy.

I think theme-name/woocommerce should be for legacy installations only and that we encourage the use of theme-name/classic-commerce.

Thoughts?

@bahiirwa
Copy link
Collaborator

Agree with approach. Yes, either....or... is neat.

@ghost
Copy link
Author

ghost commented Jan 10, 2020

I think theme-name/woocommerce should be for legacy installations only and that we encourage the use of theme-name/classic-commerce.

Yes, that's what I think as well. That solution seems perfect to me.

@timbocode
Copy link
Contributor

OK, I'll do a PR.

@timbocode timbocode added the Has PR Issue has a PR. label Jan 11, 2020
bahiirwa added a commit that referenced this issue Jan 11, 2020
Fix for theme template directory issue #167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Has PR Issue has a PR.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants