Using a Script to Merge Orders Together

If you ever need to merge an order with another order, you can simply create a custom field and a script to do this automatically. Here's how:

Users can take advantage of the Infoplus scripting capability to automatically merge orders together without having to manually edit each of them. This article will explain one way that this can be accomplished through a custom field and a bit of code. 

Infoplus Support can help with general questions about how scripting works. For help with a specific script or its outputs, you will need to submit a Pro Services request for paid support. Pro Service request form can be found here.

Note: Changes made in Infoplus will NOT be communicated back to shopping cart connections automatically. 

First, create a Custom Field on your order table and give it an appropriate name, such as 'Merge With Order.'  This field will be used to tell Infoplus what order you would like to merge into the order you are working with. For example, if you are attempting to merge order 1.000 into order 2.000, you can edit 2.000 (or whichever order you want to use) and enter 1.000 into this custom field. Make sure you include the .000. 

Note: If you are attempting to merge more than two orders you would need additional custom fields to handle them. If you are attempting to merge orders with the same line items, you will get an error unless your site is configured to allow duplicate line items per order. If your site is not configured to allow this, you can enter a support ticket to request it. 

Once you have the custom field created you will need to create a script to execute this task.  Give the script an appropriate name, choose record for script type, order for record type and beta for the API Version. 

Next, copy and paste the javascript code shown below and make sure that the variable looking for the custom field you created is named correctly and updated throughout the code. Here is where that variable is established:

No other variables in this script should need to be manipulated. 


To run this script, select the order that contains the 'Merge With' value and choose 'Run Script' from the action menu dropdown. Choose the script you just created and hit submit.