0

I'm using the latest stable version of Drupal Commerce (on Drupal 9), with every module up to date

Problem: When the add to cart button is clicked the site returns message "The website encountered an unexpected error. Please try again later." When I check the log messages it displays the error "Exception: The given entity is not assigned to any store."

Commerce setup

  • Drupal Commerce's architecture, settings, permissions, and configurations have been fully setup and every other feature is working.
  • It only has one store configured which is setup as the default store (default option is checked- the very last setting on the store's configuration page).
  • The add to cart form is setup, but when add to cart button is clicked the above behavior happens.
  • I am currently using Commerce Stripe as the payment gateway, and it is working well and able to complete orders and purchases by going to admin/commerce/orders and then manually creating orders. Everything seems to be working fully (except for the add to cart button).

I am using Stripe's payment gateway in test mode currently, and don't believe this is the issue but is it possible this is the case? (Payment's are working via stripe's test mode where stripe basically just provide's you with a fake card for testing, which as stated did work to complete purchases by navigating to admin/commerce/orders)

The log messages consistently display "Exception: The given entity is not assigned to any store." (Entity being the product or the article- both function as content entities and the add to cart button functions as a field for both of these).

What I tried to do

  • I've read through commerce's documentation numerous times and tried to setup an add to cart button on an article entity type to see if I get the same result. I was able to configure articles to include an add to cart button, and setup a view to display the articles, but when add to cart is pressed it returned the exact same message as above and the log showed the exact same error as well.
  • I did try playing around with the product entities as well as the article entity and adding reference fields specifically for the stores within each. (Add field- reference- other- store, as well as the other- configuration- store type field) I added both of these fields to both the product entities, and articles, with the theory that they'd "assign the entity to the store" and still this didn't work.
  • Then I tried adding these two fields to just about everything within commerce, the product attributes, product variation types, the order types, the order item types, the add to cart form itself, and no matter what I still get the same error messages as above.

Does anyone know how this can be resolved?

1 Answer 1

0

Found the solution here:

https://www.drupal.org/project/commerce/issues/2865233

Specifically #2, and #7.

You must make sure that the original store field is enabled for the add to cart form, then update your products. Mine was disabled, I enabled it, edited the products and now the button works. (You may be able to add your own store fields, but I tried and failed, and they were enabled. For me it was critical that the original and provided store field was the one enabled)

Your Answer

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

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