Edits history of script submission #23710 for ' Get Shop (shopify)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Shop
     * Get the store's configuration: name, domains, plan, currency and enabled presentment currencies, timezone, units, address and resource limits.
     */
    export async function main(auth: RT.Shopify) {
      const response = await fetch(
        `https://${auth.store_name}.myshopify.com/admin/api/2026-10/graphql.json`,
        {
          method: "POST",
          headers: {
            "X-Shopify-Access-Token": auth.token,
            "Content-Type": "application/json",
            Accept: "application/json",
          },
          body: JSON.stringify({
            query: `query { shop { id name email contactEmail shopOwnerName myshopifyDomain url primaryDomain { host url sslEnabled } plan { publicDisplayName partnerDevelopment shopifyPlus } currencyCode enabledPresentmentCurrencies ianaTimezone timezoneAbbreviation timezoneOffset weightUnit unitSystem taxesIncluded taxShipping orderNumberFormatPrefix orderNumberFormatSuffix shopAddress { address1 address2 city provinceCode zip countryCodeV2 phone } resourceLimits { locationLimit maxProductOptions maxProductVariants } features { giftCards storefront sellsSubscriptions reports } setupRequired checkoutApiSupported createdAt updatedAt } }`,
          }),
        }
      )
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      const { data, errors } = await response.json()
      if (errors) {
        throw new Error(JSON.stringify(errors))
      }
    
      return data.shop
    }
    

    Submitted by hugo989 3 hours ago