Fulfillment Policy

Define shipping policies, carrier rules, and fulfillment logic.

Overview

The hyperfold fulfill policy command creates and manages fulfillment policies that control how orders are shipped. Policies define carrier selection, shipping thresholds, insurance requirements, and handling procedures.

Creating Policies

# Create a fulfillment policy
$ hyperfold fulfill policy create \
  --name="Standard Domestic" \
  --type=domestic

Creating fulfillment policy...

POLICY CREATED
  Policy ID:         pol_std_dom_001
  Name:              Standard Domestic
  Type:              domestic
  Status:            active

Default rules applied:
 Free shipping over $50
 Standard carrier selection
 Insurance for orders > $100

# Create expedited policy
$ hyperfold fulfill policy create \
  --name="Premium Express" \
  --type=express \
  --carriers=fedex_express,ups_next_day \
  --max-delivery-days=2

Policy Types

TypeDescription
domesticStandard domestic shipping within country
expressExpedited shipping with guaranteed delivery
internationalCross-border shipping with customs handling
pickupIn-store or warehouse pickup
freightLarge/heavy items requiring LTL shipping

Policy Rules

# Configure policy rules
$ hyperfold fulfill policy rules pol_std_dom_001 \
  --free-shipping-threshold=75 \
  --default-carrier=usps_priority \
  --insurance-threshold=200

# Set carrier preferences by weight
$ hyperfold fulfill policy rules pol_std_dom_001 \
  --carrier-rules='[
    {"weight_max": 1, "carrier": "usps_first_class"},
    {"weight_max": 5, "carrier": "usps_priority"},
    {"weight_max": 50, "carrier": "fedex_ground"},
    {"weight_max": "*", "carrier": "fedex_freight"}
  ]'

# Configure handling time
$ hyperfold fulfill policy rules pol_std_dom_001 \
  --handling-days=1 \
  --weekend-handling=false \
  --holiday-handling=false

Managing Policies

# List all policies
$ hyperfold fulfill policy list

FULFILLMENT POLICIES

POLICY ID          NAME                TYPE        ORDERS (30d)   STATUS
pol_std_dom_001    Standard Domestic   domestic    4,521          active
pol_express_002    Premium Express     express     892            active
pol_intl_003       International       intl        234            active
pol_local_004      Local Pickup        pickup      156            active

# Show policy details
$ hyperfold fulfill policy show pol_std_dom_001

POLICY: Standard Domestic
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Type:               domestic
Created:            2025-01-15T10:00:00Z
Status:             active

SHIPPING RULES
  Free Shipping:    Orders over $75
  Default Carrier:  USPS Priority
  Handling Time:    1 business day

CARRIER SELECTION
  < 1 lb:           USPS First Class ($3.50 - $5.00)
  1-5 lb:           USPS Priority ($7.50 - $12.00)
  5-50 lb:          FedEx Ground ($9.00 - $25.00)
  > 50 lb:          FedEx Freight (quoted)

INSURANCE
  Required above:   $200
  Provider:         ShipStation Insurance
  Rate:             0.5% of declared value

RESTRICTIONS
  Excluded states:  AK, HI (use International policy)
  Hazmat:           Not supported
  Oversized:        Requires manual review

Shipping Classes

Shipping classes group products with special handling requirements:

# Create shipping classes
$ hyperfold fulfill policy class create \
  --name="Fragile" \
  --handling=special \
  --packaging=reinforced \
  --surcharge=5.00

$ hyperfold fulfill policy class create \
  --name="Oversized" \
  --handling=freight \
  --max-standard-size="24x24x24" \
  --surcharge-formula="weight * 0.50"

$ hyperfold fulfill policy class create \
  --name="Perishable" \
  --handling=expedited \
  --carriers=fedex_express_only \
  --packaging=insulated \
  --max-transit-days=2

# Assign shipping class to products
$ hyperfold catalog update --sku=VASE-001 --shipping-class=fragile
$ hyperfold catalog update --sku=CAKE-001 --shipping-class=perishable

# List shipping classes
$ hyperfold fulfill policy class list

SHIPPING CLASSES

CLASS          HANDLING    SURCHARGE    PRODUCTS
fragile        special     $5.00        142
oversized      freight     weight*0.50  38
perishable     expedited   $12.00       24
hazmat         certified   $25.00       8
standard       normal      $0.00        2,635

Exceptions

Define exceptions to override default policy behavior based on conditions:

# Create policy exceptions
$ hyperfold fulfill policy exception add pol_std_dom_001 \
  --condition="customer.tier == 'platinum'" \
  --free-shipping=always \
  --priority-handling=true

$ hyperfold fulfill policy exception add pol_std_dom_001 \
  --condition="order.subtotal > 500" \
  --free-express=true \
  --insurance=included

$ hyperfold fulfill policy exception add pol_std_dom_001 \
  --condition="product.category == 'electronics'" \
  --signature-required=true \
  --insurance-rate=1.0

# Regional exceptions
$ hyperfold fulfill policy exception add pol_std_dom_001 \
  --condition="shipping.state in ['AK', 'HI']" \
  --surcharge=15.00 \
  --carriers=usps_priority_only \
  --delivery-estimate="+2 days"

# List exceptions
$ hyperfold fulfill policy exception list pol_std_dom_001

POLICY EXCEPTIONS: Standard Domestic

PRIORITY   CONDITION                          MODIFICATIONS
1          customer.tier == 'platinum'        free_shipping, priority
2          order.subtotal > 500               free_express, insurance
3          product.category == 'electronics'  signature, insurance_1%
4          shipping.state in ['AK', 'HI']     +$15.00, +2 days

Exception Conditions

Exceptions support flexible condition expressions:

VariableProperties
customertier, orders_count, lifetime_value
ordersubtotal, item_count, weight, volume
productcategory, price, weight, shipping_class
shippingstate, country, zone, distance