When I am viewing the product page showing below error in commerce site.

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getTimezone() on null in Drupal\commerce_order\Entity\Order->getCalculationDate() (line 624 of modules\contrib\commerce\modules\order\src\Entity\Order.php).

Issue fork commerce-3206518

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Ravi Sharma created an issue. See original summary.

jsacksick’s picture

Category: Bug report » Support request
Status: Active » Fixed

The error seems to indicate that your order doesn't reference a store. Do you have a default store setup? Can you double check if a store is resolved? That is more likely an issue that is specific to your setup as this is clearly not happening on a Vanilla Drupal install.

Feel free to recategorize this as a bug report if you're able to provide reproducible steps that'd help us track down this bug.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

berramou’s picture

I have the same error but it comes from cart, when i try to access to carts i get the error, or when i place cart block in the header i get that error in all pages.
Any idea what would be the issue ?

dev.tim made their first commit to this issue’s fork.

gooddev’s picture

according to Line 669 of modules/contrib/commerce/modules/order/src/Entity/Order.php there is probably missing a Store to that order. Maybe you have delete the store in the past, but order or cart was created when store was still exisiting?

Line 669 of modules/contrib/commerce/modules/order/src/Entity/Order.php:

    $timezone = $this->getStore()->getTimezone();
bwilliams1992’s picture

Just had a similar issue myself, I think it turned out that a store was deleted with a half completed order in the database that still referenced the deleted store, deleted all order entities and it seems to have solved the issue.