Congrats for this great module :)

I installed this module, created some fee rules. Now when ever I am trying to checkout, I am getting this error on shipping pane.

EntityMetadataWrapperException: Unable to get the data property commerce_total as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442 of /var/www/iread/sites/all/modules/entity/includes/entity.wrapper.inc).

I have shipping module as well as flat rate module enabled. I tried to search for this error & found so many discussion, people claiming about shipping module as reason for this. But if I disable your module, I don't get this. So I think, even if shipping module is the reason behind this, your module is somehow triggering something for this reason.

Can we some solution for this so that we can use it along with shipping module? You can ask me for more info if needed..

Thanks,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jasen’s picture

Confirmed. I'm getting the same error.

facine’s picture

Which version of commerce used?

This error should think fixed with this patch: #1423204: Add some self healing for order line item references

jasen’s picture

I'm using Commerce 7.x-1.8, patch didn't work.

jasen’s picture

Any other ideas?

facine’s picture

I tried it with a clean installation of "Drupal Commerce Kickstart" and have had no errors using "Commerce Shipping".

Could you provide any more information?

facine’s picture

In a production site with many modules I get the following error when trying to add a line item to an order.

EntityMetadataWrapperException-1-2065083.png

EntityMetadataWrapperException-2-2065083.png

EntityMetadataWrapperException-3-2065083.png

Right here: http://drupalcode.org/project/commerce_fees.git/blob/refs/heads/7.x-1.x:...

$order_wrapper->commerce_line_items[] = $line_item;

This error occurs when:
1) We are in "/cart" and click "Update cart"
2) Or when $order changes its state from "shopping cart" to "checkout"

If we refresh everything works fine, except that it has created a "line-item" type "fee" but not assigned to the order and other property assigned. #2099685: Orphan fee line-item

I do not think it's a matter of "commerce shipping" because with the kickstart works fine.

Is there someone using commerce shipping and not have this problem?

Thanks!

facine’s picture

dj1999’s picture

Same for me.

kepesv’s picture

same here

kepesv’s picture

Priority: Normal » Major
Issue summary: View changes
mibfire’s picture

Same using commerce 1.8. https://drupal.org/node/2191499

mibfire’s picture

I tried it with a clean installation of "Drupal Commerce Kickstart" and have had no errors using "Commerce Shipping".

Could you provide any more information?

The error happens when "shipping service" is moved to the checkout page or to other page(didnt try).

georgemastro’s picture

I had the same problem even when I wanted to see the page of a single product. I erased all the orders from the database, reinstalled the fees modules and everything works fine now.

Zekvyrin’s picture

I had a similar error:

EntityMetadataWrapperException: Unable to get the data property data as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 438 of .../profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).

I got that error after trying to "go back" before completing the order and after the fee was applied.

Using latest commerce kickstart.

pyxio’s picture

I have the same problem. Did anybody solve this? Thanks!

lalbright’s picture

I have the exact same issue and am using Commerce 7.x-1.11, with Shiipping and Fees, and get the same errors at the same spot when selecting the shipping service. When I disable the Fees module, no errors in my recent errors log and no issue on the shipping service page while checking out. The rules I created with the Fees validate and actually work to add the correct Fee to the order, but not without the AJAX error. I've searched around the issue queue and linked around and don't really see any good leads. What's the status of this issue? Is there any information I can provide to help? Is there a good alternative to the Fee module to avoid this road block? This is a show stopper for my ecommerce site and I need a way to apply fees. If I were a developer I would debug and help myself, but I am not. :(

ramil g’s picture

lalbright,

I was having the same issue as you. I have Commerce Fees installed along with the shipping modules and Commerce Shipping Weight Tariff module and when switching between shipping services in the Shipping Service pane, an ajax callback occurs but I'd get an ajax error and it was because of an EntityMetadataWrapperException.

The problem has to do with Commerce Fees deleting the fee line items whenever a commerce_cart_order_refresh occurs. When the ajax callback happens it builds the form from the cache and all its data including $form_state which is where the order is typically stored. After doing a lot of debugging, I found out that there seems to be a mismatch between the two orders (the order stored in the $form_state and the actual cart order). The order in the $form_state still has the line item that Commerce Fees has deleted. So during the ajax callback when the order that contains the stale line item gets passed to contrib modules, some of the contrib modules(in my case it was Commerce Physical) loops through the order's line items and does a check for its type using an entity wrapper ($line_item_wrapper->type->value()) and it gets to that line item that doesn't exist anymore - thats when the Entity Wrapper Exception happens.

I wrote a patch for this and am attaching it here.

So basically what the module is doing right now is deleting any fee line items and then replacing it with a new one without checking if the two are the same which is not very efficient and is actually causing all this ajax errors. So this patch checks the existing fee line item and if it's exactly the same as the one being created and about to be added, then it doesn't delete the existing fee and instead just leaves it there and not add the new fee.

ramil g’s picture

Ignore the patch that I wrote above(#17). I just noticed that with that patch, if you have different conditions for applying a fee, let's say you have a fee for customers in the United States and you dont for custormers in Canada, if someone tries to checkout and selects US as their address and then goes back and changes the country to Canada, the fee that was applied does not get deleted.

The actual fix for this is actually this patch: https://www.drupal.org/node/1804592#comment-6575060
It solves the issue of the outdated $order object stored in $form_state.

munti’s picture

Patch #18 not working with address book