Articles on: Shopify

Shipit Now for Shopify - Logic


Shipit Now for Shopify - Logic


Use this to limit when a shipping method is available.


Data types


  • String, example value: 'Anders Johansson'
  • Float, example values: 3,25, 3.25
  • Integer, example value: 72
  • Boolean, example values: false, true


Cart Variables


  • $address1, example value: 'Sturegatan 13' (String)
  • $city, example value: 'Stockholm' (String)
  • $company, example value: 'Anders AB' (String)
  • $country, example value: 'SE' (String)
  • $currency, example value: 'SEK' (String)
  • $date, example value: '2025-02-07 (String) (Europe/Stockholm timezone)
  • $email, example value: '[email protected] (String)
  • $fromAddress1, example value: 'Storgata 1' (String)
  • $fromCity, example value: 'Västerås' (String)
  • $fromCompany, example value: 'Varasto 2 (String)
  • $fromCountry, example value: 'FI'
  • $fromEmail, example value: '[email protected]' (String)
  • $fromIsCompany, example value: false (Boolean)
  • $fromPhone, example value: 0701231234 (String)
  • $fromState, example value: 'Stockholms Län' (String)
  • $fromZipCode, example value: '722 13' (String)
  • $isCompany, example value: true (Boolean)
  • $itemCount, example value: 5 (Integer) (Number of distinct items, quantity ignored)
  • $locale, example value: 'sv' (String)
  • $phone, example value: '123456-2' (String)
  • $quantitySum, example value: 25 (Integer) (Sum of all item quantity sums)
  • $state, example value: 'NY' (String)
  • $subtotal, example value: 12345.2 (Float)
  • $time, example value: '14:25' (String) (Europe/Stockholm 24h format)
  • $weekday, example value: 1 (Integer) (1 = Monday, 2 = Tuesday, ..., 7 = Sunday)
  • $weight, example value: 100.2 (Float)
  • $zipCode, example value: '722 13' (String)


Functions


  • allProductsInCollection, takes one String parameter which is the Production Collection Slug and returns a Boolean whether all products in request are in the product collection or not. Example usage: allProductsInCollection('plants')
  • anyProductInCollection , takes one String parameter which is the Product Collection Slug and returns a Boolean whether any product in request are in the production collection or not. Example usage: anyProductInCollection('plants')


Binary operators


  • <, LESSER THAN
  • <=, LESSER THAN OR EQUALS TO
  • >, GREATER THAN
  • >=, GREATER THAN OR EQUALS TO
  • =, EQUALS TO
  • <>, LESSER THAN OR GREATER THAN
  • &, LOGICAL AND
  • |, LOGICAL OR
  • !=, NOT EQUALS TO (In practice same as <> operator LESSER THAN OR GREATER THAN)


Unary operators


  • !, LOGICAL NEGATION, example expressions: !true, !$isCompany, !($zipCode = '722 13' | $zipCode = '722 15')


Other features


  • Parenthesized expressions, example value: (true | false) & (false | true)
  • When there are multiple lines lines will be evaluated using the LOGICAL OR operator


Examples


  • Example weight above 20kg: $weight > 20
  • Example weight above or equal 100 or subtotal above 500: $weight >= 100 | $subtotal > 500
  • Example at least one product in plants collection: anyProductInCollection('plants') = true


Updated on: 25/06/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!