Skip to content

Commit 848864a

Browse files
Add resource limits to CurrentShop query
1 parent 3304bbc commit 848864a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

app/graphql/shopify_graphql/current_shop.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class CurrentShop
4848
transactionalSmsDisabled
4949
enabledPresentmentCurrencies
5050
#SMS_CONSENT#
51+
resourceLimits {
52+
maxProductOptions
53+
maxProductVariants
54+
}
5155
}
5256
#LOCALES_SUBQUERY#
5357
}
@@ -127,7 +131,9 @@ def parse_data(data, with_locales: false)
127131
checkout_api_supported: data.shop.checkoutApiSupported,
128132
transactional_sms_disabled: data.shop.transactionalSmsDisabled,
129133
enabled_presentment_currencies: data.shop.enabledPresentmentCurrencies,
130-
marketing_sms_consent_enabled_at_checkout: data.shop.marketingSmsConsentEnabledAtCheckout
134+
marketing_sms_consent_enabled_at_checkout: data.shop.marketingSmsConsentEnabledAtCheckout,
135+
max_product_options: data.shop.resourceLimits.maxProductOptions,
136+
max_product_variants: data.shop.resourceLimits.maxProductVariants
131137
)
132138
if with_locales
133139
response.primary_locale = data.shopLocales.find(&:primary).locale

test/fixtures/queries/current_shop.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@
5353
"SHP",
5454
"USD"
5555
],
56-
"marketingSmsConsentEnabledAtCheckout": false
56+
"marketingSmsConsentEnabledAtCheckout": false,
57+
"resourceLimits": {
58+
"maxProductOptions": 3,
59+
"maxProductVariants": 100
60+
}
5761
},
5862
"shopLocales": [
5963
{

test/graphql/shopify_graphql/current_shop_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class CurrentShopTest < ActiveSupport::TestCase
1010
assert_equal "Example Shop", shop.name
1111
assert_equal "user@example.com", shop.email
1212
assert_equal "example.myshopify.com", shop.myshopify_domain
13+
assert_equal 3, shop.max_product_options
14+
assert_equal 100, shop.max_product_variants
1315
end
1416

1517
test "returns shop with shop locales" do

0 commit comments

Comments
 (0)