Box Subscription Creation on Shopify

By default, Ordergroove will create a separate subscription for each line-item in a Shopify checkout that has been associated with a selling-plan.

If you would like Ordergroove to bundle multiple line-items in a checkout into a single bundled subscription, you can include a property at the line-item level that we will use to determine which line-items are meant to be grouped together.

The property you need to provide at the line-item level is:

__og_parent_product_id: the variant id of the “parent product” you would like the line items to be bundled beneath.


Requirements

  • The parent product does not need to be present in the cart as a line-item itself, but it must be a real product variant that exists in your shopify store. The subscription that is created in Ordergroove will reference this parent product at the top-level of the subscription for tracking and data-integrity purposes.
  • You must still add the required selling-plan id to each line item you want included in the bundle.
  • There should only be a single line-item in the cart for a given product variant that references a given __og_parent_product_id. You should not create carts that have multiple line items for the same product that reference the same __og_parent_product_id. For example, this toy example of the cart structure would not be permitted:
[...,{
	variant: 12345,
	__og_parent_product_id: 56789
	quantity: 1
},{
	variant: 12345,
	__og_parent_product_id: 56789
quantity: 1
},...]

This should instead be represented as:

[...,{
	variant: 12345,
	__og_parent_product_id: 56789
	quantity: 2
},...]

Here is an example of what the input for this attribute would look like on a product-form that is adding products to the customer's cart:

You can also consult shopify’s cart reference documentation for information on how this property can be added via API.

Each line-item that has this __og_parent_product_id set to the same variant id will be bundled into a single subscription in Ordergroove’s system after the customer checks out. For example, take a look at this shopify order:

Notice both the Tuna Cat Food and Chicken Cat Food product have the __og_parent_product_id set to the same variant id. This will cause Ordergroove to create a single subscription that encapsulates both products, and the product set on the subscription itself will be the product variant specified by the __og_parent_product_id attribute.

Alternatively, if you would like to create multiple different bundles during the same checkout experience, you should assign the to the __og_parent_product_id attribute the id of the parent product concatenated with the separator symbol “:” (quotes just to differentiate it from the rest of the text) and with a unique key that must be the same for all the products that are supposed to be under the same bundle.

For example, let’s imagine that we have the parent product of id 1 and 4 products with ids from 2 to 5. In the case where we want 2 different bundles with products {2, 3} and {4, 5} in it respectively and both using the same parent product, the following needs to be configured:

  • {2, 3}: __og_parent_product_id = ‘1:bundle_1’
  • {4, 5}: __og_parent_product_id = ‘1:bundle_2’

Overriding item quantity

By default, when we create a bundle subscription the amount of items in the cart for a bundle item will match the bundle subscription item created in Ordergroove. You can override the quantity of bundle items that will be created for the subscription by sending the __og_subscription_bundle_item_quantity on the properties of the item.

Here is an example of what the input for this property would look like on a product-form that is adding products to the customer’s cart:

<input type="hidden" name="properties[__og_subscription_bundle_item_quantity]" value="10">

Checking out with an item of quantity 3 but 10 as the overridden quantity in the property will create a bundle subscription on Ordergroove that will ship 10 items instead of the 3 initial ones sent on the checkout order.


Cart checkout examples

Single bundle

Checking out with these items with these line item properties on Shopify:

ItemQuantityProperties in the item
Banana10name="properties[__og_parent_product_id]" value="{fruit_box_id}"
Orange Juice1name="properties[__og_parent_product_id]" value="{fruit_box_id}"
Apple5name="properties[__og_parent_product_id]" value="{fruit_box_id}"

Will create this bundle in Ordergroove:

Single Bundle

Subscription parent productItemQuantity
fruit_box_idBanana10
fruit_box_idOrange Juice1
fruit_box_idApple5

Multiple bundles

Checking out with this items with these line item properties on Shopify:

ItemQuantityProperties in the item
Banana10name="properties[__og_parent_product_id]" value="{fruit_box_id:bundle1}"
Orange Juice1name="properties[__og_parent_product_id]" value="{fruit_box_id:bundle1}"
Apple5name="properties[__og_parent_product_id]" value="{fruit_box_id:bundle1}"
Strawberry2name="properties[__og_parent_product_id]" value="{fruit_box_id:bundle2}"
Grape3name="properties[__og_parent_product_id]" value="{fruit_box_id:bundle2}"
Watermelon1name="properties[__og_parent_product_id]" value="{fruit_box_id:bundle2}"

Will create these two bundles in Ordergroove:

Bundle 1

Subscription parent productItemQuantity
fruit_box_idBanana10
fruit_box_idOrange Juice1
fruit_box_idApple5

Bundle 2

Subscription parent productItemQuantity
fruit_box_idStrawberry2
fruit_box_idGrape3
fruit_box_idWatermelon1

Overriding item quantity

Here is an example of how this override works. When we add these properties to each of them, we will have the quantity overridden for the subscription created in Ordergroove for every item that has both the __og_parent_product_id and __og_subscription_bundle_item_quantity properties set.

ItemQuantityProperties in the itemQuantity of items on checkout orderQuantity for bundle item created in the subscription for future orders
Banana10name="properties[__og_subscription_bundle_item_quantity]" value="5"
name="properties[__og_parent_product_id]" value="{bundle_product_id}"
105
Orange Juice2name="properties[__og_parent_product_id]" value="{bundle_product_id}"22
Apple5name="properties[__og_subscription_bundle_item_quantity]" value="10"
name="properties[__og_parent_product_id]" value="{bundle_product_id}"
510

Product Subscription Swap

The Component Product Swap allows a customer to checkout with one product, but subscribe to another. To do so, you will need to set the __og_parent_product_id and __og_subscription_bundle_item_product_swap properties. The __og_subscription_bundle_item_product_swap should be set to the product id of the product that you would like to use for the subscription. You cannot swap to a bundle type product. For example:

Checkout ItemProperties in the itemCheckout Order ItemsFuture Subscription Items
Banananame="properties[__og_subscription_bundle_item_product_swap]" value="{orange_juice_id}"
name="properties[__og_parent_product_id]" value="{bundle_product_id}"
BananaOrange Juice

Adding Additional Bundle Items

The __og_subscription_bundle_item_additions attribute allows a customer to checkout with one product, but subscribe to multiple products. To do so, you will need to set the __og_parent_product_id and __og_subscription_bundle_item_additions properties. The __og_subscription_bundle_item_additions should be a stringified JSON blob consisting of an array of objects, with each object containing two key-value pairs - one for the new product and one for its quantity.

Input Format:

  • __og_parent_product_id: Set this to the Parent Product ID.
  • __og_subscription_bundle_item_additions: This should be a stringified JSON blob, where each object represents a new product to be added to the subscription bundle, along with it's quantity. Each object in the array should contain two key-value pairs, like this {"product": "<product_id>", "quantity": <quantity>}. Note that any additional products cannot be a bundle type.

For example:

Checkout ItemProperties in the itemCheckout Order ItemsFuture Subscription Items
Banananame="properties[__og_subscription_bundle_item_addit
ions]" value='[
{
"product':"{orange_juice_id}",
"quantity":1
},
{
"product":"{exquisite_apple_id}",
"quantity":2
}
]'
name="properties[__og_parent_product_id]" value="{bundle_product_id}"
BananaBanana
Orange Juice
Exquisite Apple

Using Multiple Attributes

Attributes can be combined for increased customization. Here are a few examples:

ScenarioCheckout ItemProperties in the itemCheckout Order Items & QuantityFuture Subscription Items & Quantity
Quantity Override and Product SwapBanananame="properties[__og_subscription_bundle_item_quantity]" value="5"
name="properties[__og_subscription_bundle_item_product_swap]" value="{orange_juice_id}"
name="properties[__og_parent_product_id]"
value="{bundle_product_id}"
Banana - 1Orange Juice - 5
Product Swap and Additional ItemsBanananame="properties[__og_subscription_bundle_item_product_swap]" value="{orange_juice_id}"
name="properties[__og_subscription_bundle_item_additions]" value='[{"product": "{grape_juice_id}", "quantity": 1}, {"product": "{exquisite_apple_id}", "quantity": 2}]'
name="properties[__og_parent_product_id]"
value="{bundle_product_id}"
Banana - 1Orange Juice - 1
Grape Juice - 1
Exquisite Apple - 2
Quantity Override, Product Swap, and Additional ItemsBanananame="properties[__og_subscription_bundle_item_quantity]" value="5"
name="properties[__og_subscription_bundle_item_product_swap]" value="{grape_juice_id}"
name="properties[__og_subscription_bundle_item_additions]" value='[{"product": "{orange_juice_id}", "quantity": 1}, {"product": "{exquisite_apple_id}", "quantity": 2}]'
name="properties[__og_parent_product_id]"
value="{bundle_product_id}"
Banana - 1Grape Juice - 5
Orange Juice - 1
Exquisite Apple - 2