Function inputs, line item properties, and metafields
Updated · SMART Functions Creator (E-TRADE PARTNER)
Choose a Function input that includes the data your conditions need. Line item properties use Attribute input, product and variant metafields use Product metafield input, and B2B company and PO number conditions use B2B input. The input type is locked after the function is created.
SMART Functions Creator builds this as a Shopify Function, with rules or in JavaScript.
Start free trialOn this page
Choose the input before saving
The editor can select a compatible input while you build a new function. Once created, the input type is locked. If an existing function does not provide the data you need, create a function with the appropriate input and test it before switching over.
| Input | What it adds |
|---|---|
| Standard input | Basic cart, customer and product data to start building |
| Customer input | More about the customer |
| Delivery input | The delivery address |
| Delivery option input | The delivery option the customer selected |
| Extended address input | Detailed shipping address fields, including P.O. box detection |
| Attribute input | Cart attributes and line item properties |
| Product input | More about the products on each cart line |
| Subscription & sale input | Selling plans and compare-at prices |
| Product metafield input | Product and variant metafield values |
| B2B input | The purchasing company and its location, for stores using Shopify B2B companies |
Line item properties: data attached to a cart line
In a Line group, select Line item property/attribute, enter the key, choose the operator, and enter the value. For example, match key _offer with value custom. The property must actually be submitted to the cart; a selected product-page checkbox alone is insufficient. Follow the line item property discount guide.
- The function reads one property key. That key is shared across its Line groups; groups can compare different values for the same key.
- The condition requires a nonempty key and comparison value. A negative comparison can also match a missing or empty property, but it matches other unexpected values too. It is not a dedicated missing-property test.
- Attribute input does not include every selector offered by other inputs. Use the available product tags or collections when combining product targeting with property conditions; do not assume the standard input's specific product and variant picker is available.
Product and variant metafields
The metafield input reads a configured product namespace/key and a configured variant namespace/key. Each is shared across the function's Line groups. You can compare different values without configuring a different key in every group.
- Metafield conditions have number operators: is greater than (number), is less than (number) and the or-equal versions, next to text operators such as is, contains and matches regex. Store plain numbers and test both sides of the boundary.
- In the rule builder, metafields act as conditions. A stored value of 15 can select a rule with a fixed 15% action; the builder does not turn a metafield value into a discount percentage. The script editor can: its "Discount set per product in a metafield" template reads the value as the percentage.
- Line item properties belong to individual cart lines. Product and variant metafields belong to Shopify catalog records. Choose the source that matches how your storefront or integration stores the data.
B2B companies and PO numbers
B2B input adds Buyer is a B2B company and Buyer is not a B2B company, Purchasing company name, and Purchasing company metafield and Purchasing company location metafield for discounts, payment and delivery customizations, and validations. Validations also get PO number, PO number is empty and PO number is not empty, so they can require a PO number for B2B orders; the template "Require a PO number for B2B orders" sets it up. These conditions need Shopify B2B companies on the store.
Do not trust customer-entered prices
A cart property can help identify an option or promotion, but buyer-supplied values are not proof of authorization or a trusted price. Configure the allowed discount in the app and combine it with suitable eligibility conditions. A property-based discount also does not add a checkbox or option selector to your theme.
Check these cases before activation
- Confirm the actual cart line contains the expected key and value.
- Test matching, nonmatching, missing, and empty values.
- Add two lines of the same variant with different properties and confirm only the intended line qualifies.
- Check mixed carts and customer eligibility, then inspect the checkout amount.
- If the needed selector is unavailable, verify Function input before rebuilding the conditions.