RuffRuff Order Limits

thumbnail

(Example) Set a wholesale-only minimum purchase amount using a customer metafield

An example that uses a customer metafield to separate large and regular wholesale customers, sets a minimum purchase amount per order for each group, and blocks everyone else from purchasing.

This example uses a customer type stored in a customer metafield to let large wholesale customers purchase with a cart subtotal of ¥100,000 or more and regular wholesale customers with ¥30,000 or more. Everyone else, including guests, cannot purchase, so it suits a wholesale-only store.

Use the Full plan and prepare customer accounts for testing. This example evaluates the entire cart in a single order, so customers other than wholesale customers cannot purchase any item. To target only specific items, choose a per-item Price type such as "Item total (before product discounts)" and specify "Eligible items."

Amounts are evaluated on the cart subtotal, which excludes shipping and tax and is calculated before discounts.

Customer

Customer type value and login status

Cart subtotal they can purchase with

Large wholesale

wholesale_large and logged in

¥100,000 or more

Regular wholesale

wholesale and logged in (no wholesale_large)

¥30,000 or more

Other members

Any other value or no value, and logged in

Cannot purchase

Guest

Not logged in

Cannot purchase

(1) Add a definition

In the Shopify admin, open a customer. Under Metafields, select "Add definition," then create and save the following customer metafield.

Setting

Example

Name

Customer type

Namespace and key

custom.customer_type

Type

Single line text (single value)

Shopify Help: Creating custom metafield definitions

(2) Add a value for each customer

Enter wholesale_large in "Customer type" for large wholesale customers and wholesale for regular wholesale customers, then save. After saving, confirm each customer's value.

Shopify Help: Adding values to metafields

(1) Create a rule

In the app admin, go to "Price limits" → "Price rules by customer group" → "Create rule," then enter "Wholesale minimum purchase amount" as the rule name.

(2) Specify the metafield to use

Under "Group condition," select "Customer metafield," enter custom for the namespace, and enter customer_type for the key. A rule can use only this one combination of namespace and key.

(3) Add the additional groups

Select "Add group" and add the following two groups. Arrange the additional groups with Large wholesale first and Regular wholesale second.

Group name

Metafield value

Large wholesale

wholesale_large

Regular wholesale

wholesale

Metafield values are matched exactly. Differences in capitalization or leading or trailing spaces prevent a match. Even if a customer type is set, the Guest limits apply when the customer is not logged in.

(4) Set the limit for each group

Set Large wholesale and Regular wholesale to "Limit" and enter only the minimum amount. Leave the maximum amount blank. Set "Member" and "Guest" to "Cannot purchase." A group set to "Cannot purchase" does not need a minimum or maximum amount.

Group

Limit

Minimum amount

Maximum amount

Large wholesale

Limit

100000

Blank

Regular wholesale

Limit

30000

Blank

Member

Cannot purchase

Not required

Not required

Guest

Cannot purchase

Not required

Not required

(5) Set the Price type

Under "Price type," select "Cart subtotal." The entire cart is evaluated, so the "Applicability" and "Eligible items" fields are not shown.

(6) Set the messages and enable the rule

Set the following messages, check "Display timing," save the settings, then select "Enable" on the details page.

Setting

Example

Message for the minimum amount

{{tierName}} customers must have a cart subtotal of {{minPrice}} or more.

Message for a blocked group

{{tierName}} customers cannot purchase.

{{minPrice}} is replaced with a plain number that has no currency symbol and no thousands separators.

With no other rules affecting the result, confirm the following. This setting does not change the quantity field on the product page. Check the result in the cart or at checkout.

Customer to test

Cart subtotal

Result of this rule

Large wholesale

¥100,000 / ¥99,999

Meets the limit / Below the minimum amount

Regular wholesale

¥30,000 / ¥29,999

Meets the limit / Below the minimum amount

A member whose customer type is empty or a different value

Any

Cannot purchase as Member

Not logged in

Any

Cannot purchase as Guest

A member whose customer type is Wholesale (capitalized)

Any

Cannot purchase as Member

Check in the cart when "Display timing" is "Cart updated and checkout," or at checkout when it is "Checkout only." Even if this rule's condition is met, the customer cannot purchase when another rule is violated.