2025 Jun 02 10:45 AM - edited 2025 Jul 10 12:52 PM
In “Before add to quote” event of my configurable product I create a unique id ("PA_UniqueId) an put it in an attribute (if attribute is empty). In a global script on the event "BeforeItemAdded" , I read that attribute and add it to a Quote Item Custom field (UCF_UniqueId)
Now when I copy that Item on the Cart, this attribute and user custom field are copied along. What I want to do is to fill them with a new unique id (because otherwise it is not unique anymore)
This I try to do in a global script with event "OnItemCopied". There I get the product from the "context.CopiedItems" and fill the attribute with a new unique id. I do the same for the user custom field of the copiedItem. The Orginal Items I leave as it is.
My question now is, how can this be saved ? Because the values are not stored (although if I debug them at the end of the script, the new values are visible in the attribute / user custom field)
Next info was found in the HELP
User copies item in quote Execute item action : Copy Performing calculations on copied item Build number of items for product types Copying product configuration Copying item attachments Saving copied items After copying products in quote event trigered context: CopiedItems : IEnumerable<IQuoteItem> OriginalItems : IEnumerable<IQuoteItem> Quote : Instance of type: Quote2 Get item column values Before quote rendering event trigered context -> Quote : Instance of type: Quote2
As far as I can see the product / quote item is not saved anymore. So what is the use of the "After copying products in quote event" to be triggered ? Some more info on how this works, and what the use is would be nice.
Who can tell me what I'm doing wrong and how I can solve my problem ?
The problem is solved... I found the solution... Not able to answer to your comments 😞
Request clarification before answering.
Hi @tomdevilder ,
As you commented in your post it's resolved, I'll provide this solution in this answer.
But please feel free to write how you resolved the issue in case anyone has the same issue in the future!
All the best,
Eric Silva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.