Skip to main content
The Firmhouse Cart and checkout validation rule can restrict how each Shopify product variant is purchased. The rule checks metafields on every variant in the cart and blocks checkout when the selected purchase option is not allowed. This is useful when you do not want to use Shopify’s product-wide setting to require a selling plan for every variant, but need to restrict only some variants. Firmhouse lets you apply validation to individual variants while leaving the other variants unrestricted.

Available metafields

Create the following metafields as Product variant definitions in Shopify. The namespace is firmhouse. An unset metafield does not add a restriction. firmhouse.requires_selling_plans does not by itself require a subscription; combine it with firmhouse.requires_subscription when a variant must be a subscription and only specific selling plans are allowed. Do not set both firmhouse.requires_subscription and firmhouse.requires_otp to true on the same variant. One blocks one-time purchases and the other blocks subscription purchases, leaving no valid purchase option.
Metafields must be defined for Variants, not Products. The validation reads the selected variant’s values.

Create the metafield definitions

  1. In Shopify admin, go to Settings > Metafields and metaobjects.
  2. In the Metafields section, select Variants.
  3. Click Add definition.
  4. Enter a descriptive name, such as Requires subscription.
  5. Change Namespace and key to the exact value from the table, such as firmhouse.requires_subscription.
  6. Select the recommended type from the table.
  7. Click Save.
  8. Repeat these steps for each restriction you need.
For firmhouse.requires_selling_plans, choose Single line text, then change One value to List of values. Add each allowed selling plan as its full Shopify global ID, for example gid://shopify/SellingPlan/1234567890.

Set restrictions on a variant

  1. In Shopify admin, go to Products and open the product.
  2. Open the variant you want to restrict.
  3. In the Metafields section, set the applicable Firmhouse values.
  4. Click Save.
Repeat this for every variant that needs a restriction. If a product has several variants, values set on one variant do not apply to the others.

Turn on the checkout rule

  1. In Shopify admin, go to Settings > Checkout.
  2. In Checkout rules, click Add rule.
  3. Select the Firmhouse Cart and checkout validation rule.
  4. Save the rule, then click Turn on.
The rule must be turned on before the metafields affect the cart or checkout.

Test the validation

Test each configured variant in your storefront:
  • For firmhouse.requires_subscription, try adding the variant without a selling plan. Checkout should be blocked.
  • For firmhouse.requires_otp, try adding the variant with a selling plan. Checkout should be blocked.
  • For firmhouse.requires_selling_plans, try one allowed and one unlisted selling plan. Only the unlisted plan should be blocked.
The error includes the product and variant title. Firmhouse uses the checkout language for supported translations and falls back to English for other languages.

Troubleshooting

If checkout is not blocked, check that:
  • the checkout rule is turned on in Shopify;
  • the metafield definition belongs to Variants;
  • the namespace and key match the table exactly;
  • the metafield value is set on the variant being added to the cart; and
  • every entry in firmhouse.requires_selling_plans is a full selling plan ID, not a selling plan group ID or display name.