Using product bundles with Shopify Scripts

Bundles can be sold with Shopify Scripts published in your store. Before you start using bundles in your store, review the following considerations:

  • Shipping and payment scripts are fully compatible with bundles.
  • Line item scripts work normally with non-bundle line items. However, line item scripts apply to bundle line items only for read-only methods. Mutating line item methods aren't applied to bundle line items.
  • Bundle components aren't readable in the cart.
  • Bundle line items are readable in the cart, so cart methods are applied to them.

Scripts apply to bundles by default, except for line item scripts. If you don't want your scripts to be applied to bundles in your store, then consider updating your scripts to filter out products by using methods such as variant, product, or line item methods.

Discounts

Discounts that are created by line item scripts aren't applied to bundles. Do one of the following if you want to apply a discount to a bundle:

Bundles and Shopify Scripts methods

Before you start using bundles in your store, review the methods in your existing scripts to ensure that they function as desired on bundled products.

Cart methods

Cart methods such as subtotal_price, subtotal_price_was, or total_weight include bundles in their output. For example, if there's a bundle in the cart, then the bundle's subtotal price is included in the total subtotal price when subtotal_price is called.

Cart method .line_items include bundles, so calls to .size or .length also include information from bundled products in their count.

The delete_if method is a mutating line item script method that can be applied to non-bundle line items. However, it does not apply to bundle line items.

Line item methods

Read-only line item methods work with line items that are included in bundles. Some examples of read-only line item methods are .original_line_price, line_price_was, .line_price_changed?, .properties_was, and properties_changed?.

Mutating line item methods are ignored if the methods are applied to line items that are included in bundles. Some examples of mutating line item methods are .change_line_price, .change_properties, and .split.

Learn more about Shopify Scripts.

Ready to start selling with Shopify?Try it free