- Issue created by @rondog469
- First commit to issue fork.
- @facine opened merge request.
- πͺπΈSpain facine
The error is that it does not find any variation with that ID.
Please, could you export the webform and share only the handler part? it usually goes at the end of the file.
- πΊπΈUnited States rondog469
Hi @facine that is indeed the entity type It is set to. I didn't change anything from before. Here is the yml from the webform export
handlers: commerce_webform_order_handler: id: commerce_webform_order handler_id: commerce_webform_order_handler label: 'Commerce Webform Order Handler' notes: '' status: true conditions: { } weight: -49 settings: store: store_entity: 7d425a50-ed52-4e92-810a-e3957d083cd8 bypass_access: false order_item: order_item_id: '' purchasable_entity_type: commerce_product_variation purchasable_entity: ':input[name="sku"]' title: '' overwrite_price: false amount: '' currency: '' quantity: ':input[name="number_of_guests"]' order_item_bundle: default fields: { } checkout: new_cart: false empty_cart: true combine_cart: true owner: ':input[name="email"]' owner_id: '' billing_profile_id: '' billing_profile_bypass_access: false payment_gateway_id: '' payment_method_id: '' cancel_url: '' hide_add_to_cart_message: true redirect: true order_state: '' order_data: '' sync: false webform_states: - completed order_states: - _new_order_ - 'order_default:draft' prevent_update: false debug: false
In the handler settings, I have "Purchasable entity type" set to "Product Variation" and that appears to be setting it to that "commerce_product_variation" value.
Also looking at the form on prod (2.0.0-beta2) and my local (3.0.0-beta5), "Purchasable Entity Type" is not available in version 2.
I am posting pics of my form settings. Basically the hidden SKU field on my webform contains the commerce product value. I onlyhave two products, "public_tour" and "private_tour".
- πΊπΈUnited States rondog469
still trying to figure out the problem here. Any ideas?
- πͺπΈSpain facine
@rondog469, I think this could be related whith: π Broken webform configuration after update. Fixed
Please could you try it with the latest dev version?
Thanks
- π²πΎMalaysia ckng
Facing the same issue when upgrading from 2.0.0-beta2 (core D9) to 3.0.0-beta10 (core D10), this should be the same as the current dev copy.
- π²πΎMalaysia ckng
In 2.x, the purchasable item commerce_product_variation is loading the entity with ['variation_id', 'sku']:
$prepared_data['product_variation'] = $this->loadEntityValue( $data['order_item']['product_variation_entity'], 'commerce_product_variation', ['variation_id', 'sku'] );
But in 3.x, ['uuid', 'variation_id'] are passed. 'sku' is missing leading to error and unable to load the entity, as the $value queried in CommerceWebformOrderHandler->loadEntityValue() is the 'sku' value. But the source of the issue is the 'sku' key is missing from commerce_product_variation entity keys. Maybe we need a special handling here?
- πΊπΈUnited States rondog469
@ckng as I find myself back in this same spot, did you come up with a solution? Our round for security updates are upon us again. If not I am going to look into that loadEntityValue you found and see if I can come up with a patch
- πΊπΈUnited States rondog469
Looking at line 1382 of CommerceWebformOrderHandler.php
foreach (['uuid', 'id', 'sku'] as $key) { $entity_keys[] = $entity_type->getKey($key); }
'sku' is always false as that key does not exist.
I think I managed to fix this for my case though. When setting up the webform handler, for "Purchasable entity" I've been using a hidden input field that contains the SKU. That is what was working on 2.x. I have since changed it to "Reference one..." and manually added my two products via the autocomplete field that appears when choose reference one.
This is by no means the correct solution. I only have 2 products so this was easy. There is definitely something wrong with the way the $prepared_data['purchasable_entity'] is set in 3.x
- πͺπΈSpain facine
I think I've found the problem; it's in this update: https://git.drupalcode.org/project/commerce_webform_order/-/blob/3.x/com..., when support for Purchasable Entity was added, the IDs weren't converted to UUIDs. We would need to do the conversion just as we do here: https://git.drupalcode.org/project/commerce_webform_order/-/blob/3.x/src....
I hope to be able to work on it soon
- Merge request !18Issue #3386001 by facine: Unable to load the specified entity of type... β (Merged) created by facine
-
facine β
committed 88ff88d9 on 3.x
Issue #3386001 by facine: Unable to load the specified entity of type...
-
facine β
committed 88ff88d9 on 3.x
Automatically closed - issue fixed for 2 weeks with no activity.