Basic Drupal Commerce functions not being seen
I am getting the following error when invoking "commerce_cart_order_product_line_item_delete()" in a custom module i'm writing.
Fatal error: Call to undefined function commerce_entity_reference_delete() in /Users/[username]/Documents/Sites/[site_name]/profiles/commerce_kickstart/modules/contrib/commerce/modules/cart/commerce_cart.module on line 1268
The "commerce_entity_reference_delete()" function that Drupal claims it can't find resides in:
/[site]/profiles/commerce_kickstart/modules/contrib/commerce/commerce.module
...which, if I understand correctly is THE main commerce module that makes the whole shopping cart functionality work. So... my commerce module is enabled (because my shopping cart is working, and which is confirmed also on the Modules page), so why isn't commerce.module serving up the function above for me?
Am I not allowed to call "commerce_cart_order_product_line_item_delete()" from a custom module?
Desperately looking for a solution... thanks!
Comments
Thanks so much for answering. I double checked and no typo; Module is there; Cleared the cache; haven't moved the commerce module from the default install location. However, now that you mention it, the default install location is not sites/all. The install threw it in the profiles/commerce_kickstart/modules location. Should they be in the sites/all folder? Also, I am not calling commerce_cart_order_product_line_item_delete(); from within another function like in your example above, but just straight out between other php code. Is that wrong?
Hi, I only just got notification that you'd replied so sorry for the delay. It's probably worth creating a quick demo module like the above and making sure that it runs in that. If it does then you know that the module isn't available from wherever you're calling it.
Whether you're calling it 'wrong' or not depends on the code you're calling it from. If you're not calling it in a module or a function, where/what are you calling it from?
If the module is in the profile then leave it there, I think you're right that it is part of the distribution - that's probably not the problem.