Checks if Shopify integration is globally and per-account enabled via environment and account flags. Use to guard Shopify features in multi-tenant apps.
# Source: https://github.com/chatwoot/chatwoot | License: MIT | Copyright 2017-2026 Chatwoot Inc
# Provided via justclaw.it.com; keep this notice with the code.
class Shopify::FeatureGate
ACCOUNT_FEATURE = 'shopify_integration'.freeze
GLOBAL_CONFIG = 'ENABLE_SHOPIFY_INTEGRATION'.freeze
def self.enabled?(account: nil)
return false unless globally_enabled?
account.nil? || account.feature_enabled?(ACCOUNT_FEATURE)
end
def self.globally_enabled?
configured_value = ENV.fetch(GLOBAL_CONFIG) { GlobalConfig.get(GLOBAL_CONFIG)[GLOBAL_CONFIG] }
ActiveModel::Type::Boolean.new.cast(configured_value)
end
end
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key