I'm getting the following error when I go to the review stage of the checkout:

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

I'm also getting an EntityMetadataWrapperException when trying to upgrade from rc2 to rc3 at update.php. I've disabled all the modules that are taking part in the checkout process (coupon, checkout progress, a couple of custom modules and even the flat rate shipping module) and am still getting this error.

Thanks in advance

Comments

msmithcti’s picture

Status: Active » Closed (fixed)

OK so I've come at it from another angle today and it was something fairly simple: I think something had gone wrong with the particular order I was using to test things. All I had to do was manually complete the order (I suppose I could have deleted it).

lukus’s picture

Version: 7.x-1.0-rc3 » 7.x-2.0-beta1

I'm receiving this error at multi-stage checkout.

If I complete the order details, proceed to review, go back to order details and then try to proceed to review this error fires up.

lukus’s picture

Status: Closed (fixed) » Active
lukus’s picture

As an update:

  • I've found if I disable the 'collect shipping methods' rule, the error doesn't occur.
  • In my case, the shipping information is collected in the first pane of the shipping process - i.e. I'm not using the default 'shipping' pane (2nd defined pane). If I use the shipping pane, the error doesn't occur
NewZeal’s picture

I want to bypass the default shipping radios too, but when I disable the collect 'shipping methods' rule then of course I have no shipping rule at all. I tried replacing with 'calculate the shipping quote for a line item' and I get further problems with the required parameter, and ultimately shipping does not show. I can live with the shipping radio but the EntityMetadataWrapperException makes it a bit difficult for people to buy stuff off the site.

NewZeal’s picture

Problem solved. I found it was a bug with commerce_shipping. Solution can be found here: http://drupal.org/node/1498484

jrviorato’s picture

I apply the patch suggested on http://drupal.org/node/1498484 to commerce_stock.module, and the problem disappeared. But I think the problem is on Commerce Shipping Module, because the problem occurs when we go to Review with a shipping line item on the cart, then the code

$line_item_wrapper->type->value()

throws the error. This instruction is present on Commerce Stock because they need to check that the cart item is of type product, ie, a type that belongs to commerce_product_line_item_types().

rszrama’s picture

Status: Active » Closed (cannot reproduce)

Looks like this issue was resolved elsewhere, and there's a possibility it was a core issue that has since been resolved. Please reopen this with more details on the Shipping bug itself if it resurfaces.

TyrelDenison’s picture

Status: Active » Closed (cannot reproduce)

I am having this issue and the patch suggested in #6 and #7 is not resolving it. The exception occurs when I am deleting an order with a rule. I have both shipping and stock installed on my site. It seems to be related to the mixture of the two, which I need on my site. Here is the backtrace.

EntityStructureWrapper->getPropertyValue('commerce_total', Array) entity.wrapper.inc:86
EntityMetadataWrapper->value() entity.wrapper.inc:440
EntityStructureWrapper->getPropertyValue('currency_code', Array) entity.wrapper.inc:86
EntityMetadataWrapper->value() entity.wrapper.inc:258
EntityValueWrapper->value() commerce_order.module:1308
commerce_order_calculate_total(Object) commerce_order.controller.inc:81
CommerceOrderEntityController->save(Object) commerce_order.module:737
commerce_order_save(Object) commerce_order.module:1283
commerce_order_status_update(Object, 'checkout_review', , NULL, 'Customer continued to the next checkout page via a submit button.') commerce_checkout.pages.inc:331
commerce_checkout_form_submit(Array, Array) form.inc:1443
form_execute_handlers('submit', Array, Array) form.inc:854
drupal_process_form('commerce_checkout_form_checkout', Array, Array) form.inc:374
drupal_build_form('commerce_checkout_form_checkout', Array) form.inc:131
drupal_get_form('commerce_checkout_form_checkout', Object, Array) commerce_checkout.pages.inc:58
commerce_checkout_router(Object) 
call_user_func_array('commerce_checkout_router', Array) menu.inc:516
menu_execute_active_handler() index.php:21

If you need any more details let me know. I'll be beating my head against this until it's done, because of course, a last minute feature request (stock) broke the site right before launch.

Update

Even after uninstalling the stock module, I get the same error. The exact context that produces the error is as follows:

-A customer enters an address into the shipping address that the client cannot ship to. A rule created to manage this fires, deleting the cart order and redirecting the customer to a page that explains what has happened.

Only now, they end up at the error page. The cart order seems to be deleted nonetheless.

Update 2

After further digging, all fingers are pointing to Entity API. According to this thread (http://drupal.org/node/1541792) an issue was initially triggered by an update in core. It seems the update exposed something with how the module handled taxonomy (http://drupal.org/node/1556192). I have not however found this exact exception listed in the Entity API issue queue, nor have I been able to connect the dots between the Entity issue mentioned above and the exact exception I receive. I have created an issue in the Entity issue queue (http://drupal.org/node/1596594) to facilitate a conversation with the people who maintain it about this issue. I am leaving the status as active here to get some thoughts on if I am following the right rabbit.

TyrelDenison’s picture

Status: Closed (cannot reproduce) » Active
TyrelDenison’s picture

Status: Closed (cannot reproduce) » Active

I am still fighting this bug and am becoming more convinced it has to do with the shipping module. I have disabled the stock module, but the issue persists. As mentioned in #4, if I disable the 'collect shipping methods' rule, the error doesn't occur. I have rewritten my order delete method(mentioned in my first post) to side-step this bug, but I consistently get the error with the following actions.

1.I take an order all the way to final review as an anonymous user.
2. I click go back at the bottom of the page.
3. On the next page(checkout page) I click cancel at the bottom of the page, returning to the cart page.*
4. Boom.

At that point I get the following error.

EntityMetadataWrapperException: Unable to get the data property type as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442 of C:\Users\tyrel_denison\LocalPantheon\Damaco-Fulfillment\profiles\commerce_kickstart\modules\entity\includes\entity.wrapper.inc). Backtrace:
EntityStructureWrapper->getPropertyValue('type', Array) entity.wrapper.inc:86
EntityMetadataWrapper->value() entity.wrapper.inc:258
EntityValueWrapper->value() commerce_line_item.module:1381
commerce_line_items_quantity(Object, Array) commerce_cart.module:58
commerce_cart_menu_item_title(1) 
call_user_func_array('commerce_cart_menu_item_title', Array) menu.inc:699
_menu_item_localize(Array, Array, 1) menu.inc:927
_menu_link_translate(Array) menu.inc:1508
_menu_tree_check_access(Array) menu.inc:1511
_menu_tree_check_access(Array) menu.inc:1498
menu_tree_check_access(Array, Array) menu.inc:1351
menu_build_tree('navigation', Array) menu.inc:1314
menu_tree_page_data('navigation', NULL, 1) menu.inc:2374
menu_set_active_trail() menu.inc:2535
menu_get_active_trail() menu.inc:2553
menu_get_active_breadcrumb() common.inc:250
drupal_get_breadcrumb() theme.inc:2476
template_process_page(Array, 'page') theme.inc:1024
theme('page', Array) common.inc:5766
drupal_render(Array) common.inc:5629
drupal_render_page('

*note that I can go to the /cart page straight from the review page by using the url with no errors

At this point, the customers order is broken beyond repair, and a browser cache flush is necessary for them to be able to order anything. The page still has update and checkout buttons, along with the nasty error. If you click either of these buttons...Boom again. New error below(which I believe is a result of the order being blown to bits).

EntityMetadataWrapperException: Unable to get the data property commerce_total as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442 of C:\Users\tyrel_denison\LocalPantheon\Damaco-Fulfillment\profiles\commerce_kickstart\modules\entity\includes\entity.wrapper.inc). Backtrace:
EntityStructureWrapper->getPropertyValue('commerce_total', Array) entity.wrapper.inc:86
EntityMetadataWrapper->value() entity.wrapper.inc:440
EntityStructureWrapper->getPropertyValue('currency_code', Array) entity.wrapper.inc:86
EntityMetadataWrapper->value() entity.wrapper.inc:258
EntityValueWrapper->value() commerce_order.module:1308
commerce_order_calculate_total(Object) commerce_order.controller.inc:81
CommerceOrderEntityController->save(Object) commerce_order.module:737
commerce_order_save(Object) commerce_checkout.module:239
commerce_checkout_line_item_views_form_submit(Array, Array) form.inc:1443
form_execute_handlers('submit', Array, Array) form.inc:854
drupal_process_form('views_form_commerce_cart_form_default', Array, Array) form.inc:374
drupal_build_form('views_form_commerce_cart_form_default', Array) form.inc:131
drupal_get_form('views_form_commerce_cart_form_default', Object, '

I am going to do a clean build and see if I can replicate this error with that. All help/input is greatly appreciated as this bug has been discovered on a live commerce site. I will keep updating as I narrow things down.

Update
The order does not actually blow up as in deleted. I have created a php page to look for the order number and it is still there. I simply cannot do anything with it(hence the need for cache clearing). I can also access the order information by viewing the checkout/order-number page, but click on any links there will also produce the second error.

googletorp’s picture

Status: Active » Closed (cannot reproduce)

EntityMetadataWrapperException: Unable to get the data property commerce_total as the parent data structure is not set.

The exception you are getting is not related to commerce_shipping unless commerce_shipping some how to remove the commerce_shipping field, but I doubt that to be the case. Commerce shipping might be triggering this issue but I doubt that it's the actual cause.

rszrama’s picture

(And you might check to make sure that the Total price field exists on Line Items in your "Field List" report. If not, use Commerce Repair.)

TyrelDenison’s picture

Thanks for the input gentlemen. I have checked my field list report and commerce total is there. I have built a new site and have added shipping, shipping flat rate, and commerce stock. So far, I cannot replicate the problem. Is it possible this is somehow related to my database? I am at a bit of a loss and trying to fix this quickly.

Update
I am also getting this error when I run a status report.

Notice: Undefined index: value in theme_status_report() (line 2572 of C:\inetpub\wwwroot\damacofulfillment\modules\system\system.admin.inc). Backtrace:
theme_status_report(Array) theme.inc:1060
theme('status_report', Array) system.admin.inc:2322
system_status() 
call_user_func_array('system_status', Array) menu.inc:516
menu_execute_active_handler() index.php:21

Is it possible the two are related?

rszrama’s picture

It could be you just had a line item with some stale data referenced by your existing order caused during testing. That happens occasionally, and you can recover from it by simply deleting your current cart order and starting a new one.

TyrelDenison’s picture

Ryan

It is definitely due to some stale reference, but I am not sure who is trying to grab it. I originally thought it was the stock module, as others have mentioned a similar issue, but when I uninstalled that module, the problem persisted. I was able to step around the error by disabling the delete shipping line items rule from the workflow. It seems something was looking for the shipping items and not finding them. While I try and figure out who was looking for it and why, I will have to leave this rule disabled so the site remains functional, as it is currently a live site. What are the risks/downsides to having this rule disabled?

rszrama’s picture

I'm not sure there's a true risk here other than Shipping line items for orders that haven't completed checkout will hang around in instances where they may otherwise have been deleted. Still, the customer shouldn't be able to progress through checkout with an invalid shipping service selected. It probably depends on the type of shipping services you're offering and the logic used to make them available, but in most cases I don't think there's a drawback.

TyrelDenison’s picture

Best news I've heard all week. Thanks Ryan.

bb_dogg’s picture

I'm also getting this problem, and it definitely appears to be connected to commerce_shipping; at least it has to do with line items that don't exist anymore. I don't know if they where shipping line items, but for some reason they are now gone, and this breaks the total order calculation which causes this error in my case.

It might be related to me skipping saving in commerce_shipping_delete_shipping_line_items, which I use in my custom shipping method, so that might actually be the cause of the items still hanging around. So make sure you save the order if you use that function.

One solution would possibly be to check if the line item actually is valid before trying to do the calculations in commerce_line_items_total, but I'm not sure if that is the proper way of doing it.

Anyways, to get around it for now, I have chosen to log the error instead of throwing an EntityMetadataWrapperException, and which doesn't seem to be any drawbacks, and the totals are still calculated correctly.

rszrama’s picture

If you're deleting shipping line items that are referenced by the order's line item reference field, then yes you do need to update the contents of that field and save the order. Start there, and if that doesn't resolve your issues we can investigate further. To a certain extent, we do have to depend on contribs to ensure they aren't breaking the data.

Anonymous’s picture

Just an FYI. I am getting this same error with no ecommerce modules enabled on my dev site:

EntityMetadataWrapperException: Unable to get the data property format as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442

mlaw’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev
Status: Closed (cannot reproduce) » Active

Commerce Modules enabled:
Commerce 7.x-1.3
Checkout Progress 7.x-1.2
Product Key 7.x-1.2
PayPal 7.x-1.x-dev
Shipping 7.x-2.0-beta1+18-dev
Flat Rate 7.x-1.0-beta1

The issue:

The error occurs after I go the Shipping page, choose a flat rate shipping method (radio buttons), and then click Continue.

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 339 of C:\wamp\www\drupalck\profiles\commerce_kickstart\modules\entity\includes\entity.wrapper.inc).

It crashes the site hard, and I can't continue anywhere else on the site unless I restart apache/sql/php or just delete all my browser cookies. I didn't receive the error prior to Commerce Shipping installation.

I've tried searching for a viable solution, but haven't found any yet. Any advice would be much appreciated! Thanks.

mlaw’s picture

Seems that my issue above in #23 was related to Commerce Product Keys. Temporary solution is a patch: http://drupal.org/node/1606378

rszrama’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta1
Status: Active » Closed (cannot reproduce)

Let's close this back then.

ursula00’s picture

Priority: Normal » Critical
Status: Closed (cannot reproduce) » Needs work

I have a similar set up to #23 but running Commerce 7.x-1.5 and having the same issues. If the patch suggested fails why is this closed and would it be safe to apply this patch on a production site?

rszrama’s picture

Priority: Critical » Normal
Status: Needs work » Closed (cannot reproduce)

If you read above, you can see that the issue was caused by another module. That's why it was closed out here - Commerce Shipping isn't responsible for problems introduced by other modules. Are you perhaps using a similar other module? Can you provide steps to reproduce the problem in a clean install of Commerce Kickstart 1.x + Commerce Shipping? We'll need that before re-opening can go anywhere.

ursula00’s picture

I assumed it was the shipping module as everything worked fine before I installed it. Nonetheless I applied the patch and all is working fine thanks!

perforator’s picture

Issue summary: View changes

I had similar problems with "giftwrap": https://drupal.org/node/2242325