Shopping Cart Script - How to Apply Default Values to Shopify Orders

Infoplus Shopping Cart Connection Scripts can be used to auto-populate missing data on orders coming from Shopify such as missing billing, shipping or customer information.

    There are cases where an order coming in from Shopify may be missing one or more required fields in the following sections its data:

    • Billing To Address

    • Ship To Address

    • Customer Details

    Since these sections include fields that are necessary for order processing, Infoplus will reject orders missing any required fields in these sections. This creates in an automated Alert detailing the issue.

    Amazon Ground Shipping

    Orders designated for Amazon Ground Shipping from Shopify are required to have both a shipping address email and phone number. While InfoPlus does not reject orders missing this information, Amazon Ground label generation will be unsuccessful if this information is missing.

    For more details on Amazon Ground Shipping please see the Amazon Ground Shipping article.

    Solution

    Infoplus Shopping Cart Connection Scripts can be used to automatically populate missing billing, shipping, and customer information on incoming Shopify orders. You can leverage Shopping Cart Connection scripts to first identify any missing data and, if necessary, fill in the missing data with predefined values, avoiding Shopify import errors.
    Please see the example below for more details on how to implement a scripting solution.

    Infoplus Support can help with general questions about how scripting works. For help with a specific script please submit a Pro Services request here.

    Create and Configure a Shopping Cart Connection Script

    1. Create a Script: Start by creating a new script with the "Shopping Cart Connection Order" type.

    2. Write the Code: Populate the "Code" section to make the necessary modifications to the address variable (see examples below).

    3. Apply the Script: Navigate the Shopping Cart Connection Table. Edit the desired Shopping Cart Connection record and select the newly created script in the script field. Remember to save your changes.

    4. Verify Script Functionality: Use the script log table to confirm that the script is working as expected.

    Example Script

    Scenario 1: Order Import Errors Due to Incomplete Shopify Addresses

    • User Issue: Orders from Shopify fail to import into InfoPlus because the billing or shipping addresses lack mandatory InfoPlus fields.
    • Script Solution: A script is used to verify the completeness of Shopify shipping and billing addresses. If required fields are missing, default addresses are applied, ensuring seamless order import into InfoPlus.

    Scenario 2: Amazon Ground Shipping Label Generation Failure

    • User Issue: Amazon Ground Shipping parcel labels cannot be generated due to missing email or phone numbers in the Shopify shipping address.
    • Script Solution: The same script used in Scenario 1 also addresses this issue by validating and populating missing email and phone numbers, allowing for successful Amazon Ground label generation.

    NOTE: The example script allows you to selectively enable or disable specific address validations. For instance, if you're not using Amazon Ground Shipping, you can disable the shipping_address_phone and shipping_address_email validations by setting them to false

    How to toggle validation on/off for specific fields