Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is it possible to add a product with a custom line item only to the recurring order?
I try to use the hook_commerce_order_presave(), but this ends with this error.
EntityMetadataWrapperException: Unknown data property cl_billing_license. in EntityStructureWrapper->getPropertyInfo() (Zeile 335 von /var/www/clients/client1/web1/web/drupal/sites/all/modules/entity/includes/entity.wrapper.inc).
Comment | File | Size | Author |
---|---|---|---|
#2 | commerce_license_billing_add_product1.patch | 2.46 KB | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedToday I created a recurring postpaid order in the tradtional way without interacting from my module. I just want to find out what happens if I add a produt to the recurring order which is created by the commerce license billing module.
After adding a product to the recurring order and clicked save I get the drupal error page. In the watchdog log I see now this error. The added product is not marked as a recurring product
It's excactly the same behavior independent of the interaction of my module. It breaks the complete order for now. I marked this as critical, because the usage of the order page is not usable anymore.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedThis patch solves the problem with the added not recurring products and also fixes the issue that commerce_license_billing break hook_commerce_order_presave(). Now I can use this hook to add products which are not recurring to the recurring order. I testet it in the postpaid mode.
I just notice if I edit a recurring order and click save the prices are set to 0. This occurs with original module version as with the patched one. Is this behavior known?
Comment #3
bojanz CreditAttribution: bojanz commentedThe recurring order only has recurring line items, generated from the active licenses.
It is auto-generated and auto-updated, so no manual updates are allowed, and certainly not with non-recurring products.
You will need to go back and present your use case (what you're actually trying to accomplish) so that we can determine the correct
way to do it.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedThank you bojanz for your reply.
I try to explain what I want to do. I have 3 Products wich sell the same licence file. In my case it's a software plugin. The diffrence between the 3 products are the monthly recurring prices and the dependent comission amount.
Example Product Starter:
(Customer sales amount made with my plugin: 1000€ calculated comission 20€)
Example Product Business:
(Customer sales amount made with my plugin: 1000€ calculated comission 10€)
The ideal programm flow should be:
The commission product is not a recurring one at the moment. That's all. So please give some advice to get that task working.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #7
cac3a CreditAttribution: cac3a commentedI tried using this code in the patch and non-recurring products aren't still showing on license based orders. Is there another solution to add non-recurring products to recurring orders ?