1

We are in development of our new site in Craft 3 and we are getting some deprecation errors. This is keeping us from using Craft Commerce for our ordering page. Any suggestions on how to fix this?

Message Origin  Last Occurrence Stack Trace 
The Purchasable::getPurchasableId() function has been deprecated. Use Purchasable::getId() instead. /srv/captioncall/templates/buy/index.twig:6 Yesterday   Stack Trace 
craft.session.getFlash() has been deprecated. Use craft.app.session.getFlash() instead. /srv/captioncall/templates/buy/index.twig:33    Yesterday   Stack Trace 
craft.session.getFlash() has been deprecated. Use craft.app.session.getFlash() instead. /srv/captioncall/templates/buy/index.twig:34    Yesterday   Stack Trace

1 Answer 1

2

I'm not sure I can tell you much more than the error messages are telling you, you need to update your twig code eg. in index.twig (line 6) where it says; getPurchasableId() change it to getId().

These errors are just warning you that a future version of Craft won't support them (I imagine it will be Craft 4, but could be sooner).

Changing e-commerce systems based on this error would not be advised as it's a very simple fix!

2
  • Thank you so much. I am new to Craft and Twig and we have a third party helping us get all this setup in a staging environment before we deploy to our primary server. So, it's not alarming. I really appreciate you getting back to me so fast. Oct 22, 2019 at 14:32
  • @SamSumpter can you mark this question as answered? Apr 23, 2020 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.