-
Notifications
You must be signed in to change notification settings - Fork 170
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
[4.6.2]: Calling unknown method: craft\elements\User::getPrimaryBillingAddress() #3546
Comments
Hi @lukasNo1 Can you let us know which other plugins you have installed in your project. We have seen this issue before when not all plugins in a project are using Craft's Thanks.. |
Hey @nfourtythree Thanks for the help. I just checked the project and the code that seems to be the problem is inside a module:
I need to check the user as early as possible, because we have custom redirects for every user. I tested putting the code in some other Event like CraftVariable::EVENT_INIT which apparently works. Do you know if this is something you can fix, or is it just "forbidden :)" to query the user onInit or after_load_plugins |
Hi @lukasNo1 Thank you for your detailed response, that is appreciated to understand what is happening. Before I get to a potential solution it is worth noting that the As for how we can solve what is going on, it might be good to understand what you are trying to achieve in your module's If it is easier, you can send your explanation along with your project files to support@craftcms.com and we can continue the conversation there, hopefully get to the bottom of what is happening and get your project back on its way. Thanks! |
Our usecase is this: I can put the redirect code in CraftVariable::EVENT_INIT which works for now. Although its not really the right place for it. |
Hi @lukasNo1 Thank you for your response. After further internal discussion, we have revised the guidelines for when plugins and modules should use We recommend that people use that function in their plugin/module when they have:
We have just released Commerce Hope this helps, thank you for your help, feedback and patience. Thanks! |
Thank you! I can confirm that my code now works in the onInit() method. |
What happened?
Description
I just updated from 4.6.1 to 4.6.2
I have this code in my template which doesn't work anymore now.
{% set primaryBillingAddress = currentUser ? currentUser.getPrimaryBillingAddress() : null %}
Throwing the following error:
Calling unknown method: craft\elements\User::getPrimaryBillingAddress()
Craft CMS version
4.10.0
Craft Commerce version
4.6.2
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: