From aeae13b671511afdcd0a8ccab90a508d37f719fa Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Sat, 28 Sep 2019 16:00:04 -0500 Subject: [PATCH 1/5] create and move files --- _data/toc/graphql.yml | 14 +- _data/whats-new.yml | 4 +- .../graphql/develop/create-graphqls-file.md | 2 +- guides/v2.3/graphql/index.md | 2 +- .../v2.3/graphql/product/product-interface.md | 263 +++++++++++++++++ .../graphql/{queries.md => queries/index.md} | 0 guides/v2.3/graphql/queries/products.md | 272 +----------------- guides/v2.3/graphql/release-notes.md | 2 +- 8 files changed, 282 insertions(+), 277 deletions(-) create mode 100644 guides/v2.3/graphql/product/product-interface.md rename guides/v2.3/graphql/{queries.md => queries/index.md} (100%) diff --git a/_data/toc/graphql.yml b/_data/toc/graphql.yml index 7ec5c15b4aa..79c65efa7bd 100644 --- a/_data/toc/graphql.yml +++ b/_data/toc/graphql.yml @@ -13,12 +13,6 @@ pages: - label: Get customer authorization token url: /graphql/get-customer-authorization-token.html - - label: Queries - url: /graphql/queries.html - - - label: Mutations - url: /graphql/mutations.html - - label: GraphQL Caching url: /graphql/caching.html @@ -47,6 +41,9 @@ pages: - label: Queries children: + - label: Using queries + url: /graphql/queries/index.html + - label: cart query url: /graphql/queries/cart.html @@ -112,6 +109,9 @@ pages: - label: Mutations children: + - label: Using mutations + url: /graphql/mutations/index.html + - label: addConfigurableProductsToCart mutation url: /graphql/mutations/add-configurable-products.html @@ -214,7 +214,7 @@ pages: - label: updateCustomerAddress mutation url: /graphql/mutations/update-customer-address.html - - label: Product data types and interfaces + - label: Catalog data types and interfaces children: - label: Product interface implementations url: /graphql/product/product-interface-implementations.html diff --git a/_data/whats-new.yml b/_data/whats-new.yml index c2ca023c974..ca5bbf9e9fb 100644 --- a/_data/whats-new.yml +++ b/_data/whats-new.yml @@ -1150,7 +1150,7 @@ entries: date: March 26, 2019 link: https://github.com/magento/devdocs/pull/3867 - description: The "Searches and Pagination" topic has been expanded to include more - information about queries and renamed to ["Queries"](https://devdocs.magento.com/guides/v2.3/graphql/queries.html). + information about queries and renamed to ["Using queries"](https://devdocs.magento.com/guides/v2.3/graphql/queries/index.html). versions: 2.3.1 type: Major update date: March 26, 2019 @@ -1176,7 +1176,7 @@ entries: type: Major update date: March 26, 2019 link: https://github.com/magento/devdocs/pull/3851 -- description: Added a topic on [GraphQL mutations](https://devdocs.magento.com/guides/v2.3/graphql/mutations.html) +- description: Added a topic on [GraphQL mutations](https://devdocs.magento.com/guides/v2.3/graphql/mutations/index.html) versions: 2.3.1 type: New topic date: March 26, 2019 diff --git a/guides/v2.3/graphql/develop/create-graphqls-file.md b/guides/v2.3/graphql/develop/create-graphqls-file.md index 33deb38fb43..9ea9c37e3fb 100644 --- a/guides/v2.3/graphql/develop/create-graphqls-file.md +++ b/guides/v2.3/graphql/develop/create-graphqls-file.md @@ -22,7 +22,7 @@ The base `schema.graphqls` file, located in the `app/code/Magento/GraphQl/etc/` A query definition can be one line, or it can be complex. If your module's query implements `searchCriteria`, then you must define arguments that define filters and pagination information, all of which adds complexity. However, if you expect a single result from your query, then its definition can be simple. -The following example shows the `products` query. The `type` is defined as a `Query`. The `products` definitions define the keywords that are used to construct a query, as shown in [Queries]({{ page.baseurl }}/graphql/queries.html). The parameter definitions will be discussed in [Specify output attributes](#specify-output-attributes). +The following example shows the `products` query. The `type` is defined as a `Query`. The `products` definitions define the keywords that are used to construct a query, as shown in [Queries]({{ page.baseurl }}/graphql/queries/index.html). The parameter definitions will be discussed in [Specify output attributes](#specify-output-attributes). ```text type Query { diff --git a/guides/v2.3/graphql/index.md b/guides/v2.3/graphql/index.md index 33bfa0b197a..076a36050f4 100755 --- a/guides/v2.3/graphql/index.md +++ b/guides/v2.3/graphql/index.md @@ -47,4 +47,4 @@ GraphiQL is an in-browser tool for writing, validating, and testing GraphQL quer ![GraphiQL browser]({{ page.baseurl }}/graphql/images/graphql-browser.png) -To begin using GraphiQL, set the GraphQL endpoint by entering `http:///graphql` in the URL bar, then click **Set endpoint**. You can use the browser in the right column to determine how to set up a query. Additional examples are also available in [Queries]({{ page.baseurl }}/graphql/queries.html). +To begin using GraphiQL, set the GraphQL endpoint by entering `http:///graphql` in the URL bar, then click **Set endpoint**. You can use the browser in the right column to determine how to set up a query. Additional examples are also available in [Queries]({{ page.baseurl }}/graphql/queries/index.html). diff --git a/guides/v2.3/graphql/product/product-interface.md b/guides/v2.3/graphql/product/product-interface.md new file mode 100644 index 00000000000..fa9adbfbbb8 --- /dev/null +++ b/guides/v2.3/graphql/product/product-interface.md @@ -0,0 +1,263 @@ +--- +group: graphql +title: ProductInterface attributes +--- + +Any type that implements `ProductInterface` contains all the base attributes necessary for the frontend of the product model. +The `items` that are returned in a `ProductInterface` array can also contain attributes from resources external to the `CatalogGraphQl` module: + +- Custom and extension attributes defined in any attribute set +- The attribute is defined in the [PhysicalProductInterface](#PhysicalProductInterface) or [CustomizableOptionInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) +- Product types that define their own implementation of `ProductInterface` including: + - [BundleProduct]({{ page.baseurl }}/graphql/product/bundle-product.html) + - [ConfigurableProduct]({{ page.baseurl }}/graphql/product/configurable-product.html) + - [DownloadableProduct]({{ page.baseurl }}/graphql/product/downloadable-product.html) + - [GroupedProduct]({{ page.baseurl }}/graphql/product/grouped-product.html) + +## ProductInterface attributes + +The following table defines the `ProductInterface` attributes and objects. + +Attribute | Data type | Description +--- | --- | --- +`attribute_set_id` | Int | The attribute set assigned to the product +`canonical_url` | String | The canonical URL for the product +`categories` | [CategoryInterface] | The categories assigned to the product. See [categories query]({{ page.baseurl }}/graphql/queries/category.html) for more information +`country_of_manufacture` | String | The product's country of origin +`created_at` | String | Timestamp indicating when the product was created +`crosssell_products` | [[ProductInterface](#ProductInterface)] | An array of cross-sell products +`description` | ComplexTextValue | An object that contains detailed information about the product. The object can include simple HTML tags +`gift_message_available` | String | Indicates whether a gift message is available +`id` | Int | The ID number assigned to the product +`image` | [ProductImage](#ProductImage) | An object that contains the URL and label for the main image on the product page +`is_returnable` | String | Indicates whether the product can be returned. This attribute is defined in the `RmaGraphQl` module. +`manufacturer` | Int | A number representing the product's manufacturer +`media_gallery` | [[MediaGalleryInterface]](#MediaGalleryInterface) | An array of media gallery objects +`media_gallery_entries` | [MediaGalleryEntry] | Deprecated. Use `media_gallery` instead +`meta_description` | String | A brief overview of the product for search results listings, maximum 255 characters +`meta_keyword` | String | A comma-separated list of keywords that are visible only to search engines +`meta_title` | String | A string that is displayed in the title bar and tab of the browser and in search results lists +`name` | String | The product name. Customers use this name to identify the product. +`new_from_date` | String | The beginning date for new product listings, and determines if the product is featured as a new product +`new_to_date` | String | The end date for new product listings +`only_x_left_in_stock` | Float | The "Only X left Threshold" assigned to the product. This attribute is defined in the `InventoryGraphQl` module. +`options_container` | String | If the product has multiple options, determines where they appear on the product page +`price` | ProductPrices | The price of an item. A `ProductPrice` object is returned. See [ProductPrices](#ProductPrices) for more information. +`product_links` | [ProductLinksInterface] | An array of [ProductLinks](#ProductLinks) objects +`related_products` | [[ProductInterface](#ProductInterface)] | An array of related products +`short_description` | ComplexTextValue | An object that contains a short description of the product. Its use depends on the store's theme. The object can include simple HTML tags +`sku` | String | A number or code assigned to a product to identify the product, options, price, and manufacturer +`small_image` | [ProductImage](#ProductImage) | An object that contains the URL and label for the small image used on catalog pages +`special_from_date` | String | The beginning date that a product has a special price +`special_price` | Float | The discounted price of the product +`special_to_date` | String | The end date that a product has a special price +`stock_status` | ProductStockStatus | The status of the stock. `ProductStockStatus` is an enumeration that can have the value of `IN_STOCK` or `OUT_OF_STOCK`. This attribute is defined in the `InventoryGraphQl` module. +`swatch_image` | String | The file name of a swatch image. This attribute is defined in the `SwatchesGraphQl` module. +`tax_class_id` | Int | An ID assigned to a tax class. This attribute is defined in the `TaxGraphQl` module. +`thumbnail` | [ProductImage](#ProductImage) | An object that contains the URL and label for the product's thumbnail image +`tier_price` | Float | The price when tier pricing is in effect and the items purchased threshold has been reached +`tier_prices` | [ProductTierPrices] | An array of [ProductTierPrices](#ProductTier) objects +`type_id` | String | One of `simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable` +`updated_at` | String | The timestamp indicating when the product was last updated +`upsell_products` | [[ProductInterface](#ProductInterface)] | An array of up-sell products +`url_key` | String | The part of the URL that identifies the product. This attribute is defined in the `CatalogUrlRewriteGraphQl` module +`url_path` | String | Deprecated. Use `canonical_url` instead +`url_rewrites` | [[UrlRewrite]](#urlRewriteObject) | A list of URL rewrites. See [UrlRewrite object](#urlRewriteObject) for more information and an [example query](#urlRewriteExample) +`websites` | [Website] | An array of websites in which the product is available. See [Website object](#websiteObject) for more information and an [example query](#inclWebsiteInfoExample) + +### ProductPrices object {#ProductPrices} + +The `ProductPrices` object contains the regular price of an item, as well as its minimum and maximum prices. Only composite products, which include bundle, configurable, and grouped products, can contain a minimum and maximum price. + +Attribute | Data Type | Description +--- | --- | --- +`maximalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the highest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "to" value. +`minimalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the lowest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "from" value. +`regularPrice` | Price | The base price of a product. + +#### Price object {#Price} + +The `Price` object defines the price of a product as well as any tax-related adjustments. + +Attribute | Data Type | Description +--- | --- | --- +`amount` | Money | The price of the product and its currency code. See [Money object](#Money). +`adjustments` | [PriceAdjustment] | An array of [PriceAdjustment](#PriceAdjustment) objects. + +##### Money object {#Money} + +A `Money` object defines a monetary value, including a numeric value and a currency code. + +Attribute | Data Type | Description +--- | --- | --- +`currency` | CurrencyEnum | A three-letter currency code, such as `USD` or `EUR`. +`value` | Float | The price of the product + +##### PriceAdjustment array {#PriceAdjustment} + +The `PricedAdjustment` object defines the amount of money to apply as an adjustment, the type of adjustment to apply, and whether the item is included or excluded from the adjustment. + +Attribute | Data Type | Description +--- | --- | --- +`amount` | Money | The amount of the price adjustment and its currency code. See [Money object](#Money). +`code` | PriceAdjustmentCodesEnum | One of `tax`, `weee`, or `weee_tax`. +`description` | PriceAdjustmentDescriptionEnum | Indicates whether the entity described by the code attribute is included or excluded from the adjustment. + +#### ProductLinks object {#ProductLinks} + +`ProductLinks` contains information about linked products, including the link type and product type of each item. + +Attribute | Type | Description +--- | --- | --- +`link_type` | String | One of `related`, `associated`, `upsell`, or `crosssell`. +`linked_product_sku` | String | The SKU of the linked product +`linked_product_type` | String | The type of linked product (`simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable`) +`position` | Int | The position within the list of product links +`sku` | String | The identifier of the linked product + +### MediaGalleryInterface {#MediaGalleryInterface} + +The `MediaGalleryInterface` contains basic information about a product image or video. + +Attribute | Type | Description +--- | --- | --- +`label` | String | The label for the product image or video +`url` | String | The URL for the product image or video + +### ProductImage object {#ProductImage} + +`ProductImage` implements [`MediaGalleryInterface`](#MediaGalleryInterface), which contains information about an image's URL and label. + +### ProductVideo object {#ProductVideo} + +`ProductVideo` implements [`MediaGalleryInterface`](#MediaGalleryInterface) and contains information about a product video. + +Attribute | Type | Description +--- | --- | --- +`video_content` | ProductMediaGalleryEntriesVideoContent | Contains a [ProductMediaGalleryEntriesVideoContent](#ProductMediaGalleryEntriesVideoContent) object + +### MediaGalleryEntry object {#MediaGalleryEntry} + +`MediaGalleryEntry` defines characteristics about images and videos associated with a specific product. + +Attribute | Type | Description +--- | --- | --- +`content` | ProductMediaGalleryEntriesContent | Contains a [ProductMediaGalleryEntriesContent](#ProductMediaGalleryEntriesContent) object +`disabled` | Boolean | Whether the image is hidden from view +`file` | String | The path of the image on the server +`id` | Int | The identifier assigned to the object +`label` | String | The "alt" text displayed on the UI when the user points to the image +`media_type` | String | `image` or `video` +`position` | Int | The media item's position after it has been sorted +`types` | [String] | Array of image types. It can have the following values: `image`, `small_image`, `thumbnail` +`video_content` | ProductMediaGalleryEntriesVideoContent | Contains a [ProductMediaGalleryEntriesVideoContent](#ProductMediaGalleryEntriesVideoContent) object + +#### ProductMediaGalleryEntriesContent object {#ProductMediaGalleryEntriesContent} + +`ProductMediaGalleryEntriesContent` contains an image in base64 format and basic information about the image. + +Attribute | Type | Description +--- | --- | --- +`base64_encoded_data` | String | The image in base64 format +`name` | String | The file name of the image +`type` | String | The MIME type of the file, such as `image/png` + +#### ProductMediaGalleryEntriesVideoContent object {#ProductMediaGalleryEntriesVideoContent} + +`ProductMediaGalleryEntriesVideoContent` contains a link to a video file and basic information about the video. + +Attribute | Type | Description +--- | --- | --- +`media_type` | String | Must be `external-video` +`video_description` | String | A description of the video +`video_metadata` | String | Optional data about the video +`video_provider` | String | Optionally describes the video source +`video_title` | String | The title of the video +`video_url` | String | The URL to the video + +### ProductTierPrices object {#ProductTier} + +The `ProductTierPrices` object defines a tier price, which is a quantity discount offered to a specific customer group. + +Attribute | Type | Description +--- | --- | --- +`customer_group_id` | Int | The ID of the customer group +`percentage_value` | Float | The percentage discount of the item +`qty` | Float | The number of items that must be purchased to qualify for tier pricing +`value` | Float | The price of the fixed price item +`website_id` | Int | The ID assigned to the website + +## PhysicalProductInterface {#PhysicalProductInterface} + +`PhysicalProductInterface`defines the weight of all tangible products. + +Attribute | Type | Description +--- | --- | --- +`weight` | Float | The weight of the item, in units defined by the store + +## LayerFilter object + +The `LayerFilter` object can be returned in a response to help create layered navigation on your app. + +Attribute | Type | Description +--- | --- | --- +`filter_items` | [LayerFilterItemInterface] | An array of filter items +`filter_items_count` | Int | The number of filter items in filter group +`name` | String | The layered navigation filter name +`request_var` | String | The request variable name for the filter query + +### LayerFilterItemInterface + +`LayerFilterItemInterface` contains an array of items that match the terms defined in the filter. + +Attribute | Type | Description +--- | --- | --- +`items_count` | Int | The number of items the filter returned +`label` | String | The label applied to a filter +`value_string` | String | The value for filter request variable to be used in a query + +## SortFields object + +The `SortFields` object contains the default value for sort fields as well as all possible sort fields. + +Attribute | Type | Description +--- | --- | --- +`default` | String | The default sort field +`options` | `SortField` | An array that contains all the fields you can use for sorting + +### SortField object + +Attribute | Type | Description +--- | --- | --- +`label` | String | The attribute's label +`value` | String | The attribute name or code to use as the sort field + +### Website object {#websiteObject} + +Use the `Website` attributes to retrieve information about the website's configuration, which includes the website name, website code, and default group ID. + +Attribute | Data Type | Description +--- | --- | --- +`code` | String | A code assigned to the website to identify it +`default_group_id` | String | The default group ID that the website has +`id` | Integer | The ID number assigned to the store +`name` | String | The website name. Websites use this name to identify it easier. +`sort_order` | Integer | The attribute to use for sorting websites + +### UrlRewrite object {#urlRewriteObject} + +The `products` query can request details about the `UrlRewrite` object. + +Attribute | Type | Description +--- | --- | --- +`parameters` | [[`HttpQueryParameter`]](#HttpQueryParameter) | An array of target path parameters +`url` | String | The request URL + +### HTTPQueryParameter object {#HttpQueryParameter} + +The `HttpQueryParameter` object provides details about target path parameters. + +Attribute | Type | Description +--- | --- | --- +`name` | String | The parameter name, such as `id` +`value` | String | The value assigned to the parameter diff --git a/guides/v2.3/graphql/queries.md b/guides/v2.3/graphql/queries/index.md similarity index 100% rename from guides/v2.3/graphql/queries.md rename to guides/v2.3/graphql/queries/index.md diff --git a/guides/v2.3/graphql/queries/products.md b/guides/v2.3/graphql/queries/products.md index 4aafdc0868f..c628b553ab9 100644 --- a/guides/v2.3/graphql/queries/products.md +++ b/guides/v2.3/graphql/queries/products.md @@ -7,7 +7,7 @@ redirect_from: The `products` query allows you to search for catalog items. -## Query structure +## Syntax ```graphql products( @@ -23,11 +23,11 @@ Each query attribute is defined below: Attribute | Description --- | --- -`search` | Performs a full-text search using the specified key words. This attribute is optional. See [Queries]({{ page.baseurl }}/graphql/queries.html) for more information. +`search` | Performs a full-text search using the specified key words. This attribute is optional. See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information. `filter` | Identifies which attributes to search for and return. This attribute is required. See [ProductFilterInput](#ProductFilterInput) for more information. -`pageSize` | Specifies the maximum number of results to return at once. The default value is 20. See [Queries]({{ page.baseurl }}/graphql/queries.html) for more information. -`currentPage` | Specifies which page of results to return. The default value is 1. See [Queries]({{ page.baseurl }}/graphql/queries.html) for more information. -`sort` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Queries]({{ page.baseurl }}/graphql/queries.html) for more information. +`pageSize` | Specifies the maximum number of results to return at once. The default value is 20. See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information. +`currentPage` | Specifies which page of results to return. The default value is 1. See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information. +`sort` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information. `Products` | An output object that contains the results of the query. See [Response](#Response) for details. ## ProductFilterInput object {#ProductFilterInput} @@ -45,7 +45,7 @@ filter: { } ``` -See [Queries]({{ page.baseurl }}/graphql/queries.html) for more information about the operators. +See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information about the operators. Magento processes the attribute values specified in a `ProductFilterInput` as simple data types (strings, integers, booleans). However, returned attributes can be a different, complex, data type. For example, in a response, `price` is an object that contains a monetary value and a currency code. @@ -146,268 +146,10 @@ When a product requires a filter attribute that is not a field on its output sch This example adds `field_to_sort` and `other_field_to_sort` attributes to the `additionalAttributes` array defined in the `ProductEntityAttributesForAst` class. The array already contains the `min_price`, `max_price`, and `category_ids` attributes. -## ProductInterface {#ProductInterface} - -Any type that implements `ProductInterface` contains all the base attributes necessary for the frontend of the product model. -The `items` that are returned in a `ProductInterface` array can also contain attributes from resources external to the `CatalogGraphQl` module: - -* Custom and extension attributes defined in any attribute set -* The attribute is defined in the [PhysicalProductInterface](#PhysicalProductInterface) or [CustomizableOptionInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) -* Product types that define their own implementation of `ProductInterface` including: - * [BundleProduct]({{ page.baseurl }}/graphql/product/bundle-product.html) - * [ConfigurableProduct]({{ page.baseurl }}/graphql/product/configurable-product.html) - * [DownloadableProduct]({{ page.baseurl }}/graphql/product/downloadable-product.html) - * [GroupedProduct]({{ page.baseurl }}/graphql/product/grouped-product.html) - -The following table defines the `ProductInterface` attributes and objects. - -Attribute | Data type | Description ---- | --- | --- -`attribute_set_id` | Int | The attribute set assigned to the product -`canonical_url` | String | The canonical URL for the product -`categories` | [CategoryInterface] | The categories assigned to the product. See [categories query]({{ page.baseurl }}/graphql/queries/category.html) for more information -`country_of_manufacture` | String | The product's country of origin -`created_at` | String | Timestamp indicating when the product was created -`crosssell_products` | [[ProductInterface](#ProductInterface)] | An array of cross-sell products -`description` | ComplexTextValue | An object that contains detailed information about the product. The object can include simple HTML tags -`gift_message_available` | String | Indicates whether a gift message is available -`id` | Int | The ID number assigned to the product -`image` | [ProductImage](#ProductImage) | An object that contains the URL and label for the main image on the product page -`is_returnable` | String | Indicates whether the product can be returned. This attribute is defined in the `RmaGraphQl` module. -`manufacturer` | Int | A number representing the product's manufacturer -`media_gallery` | [[MediaGalleryInterface]](#MediaGalleryInterface) | An array of media gallery objects -`media_gallery_entries` | [MediaGalleryEntry] | Deprecated. Use `media_gallery` instead -`meta_description` | String | A brief overview of the product for search results listings, maximum 255 characters -`meta_keyword` | String | A comma-separated list of keywords that are visible only to search engines -`meta_title` | String | A string that is displayed in the title bar and tab of the browser and in search results lists -`name` | String | The product name. Customers use this name to identify the product. -`new_from_date` | String | The beginning date for new product listings, and determines if the product is featured as a new product -`new_to_date` | String | The end date for new product listings -`only_x_left_in_stock` | Float | The "Only X left Threshold" assigned to the product. This attribute is defined in the `InventoryGraphQl` module. -`options_container` | String | If the product has multiple options, determines where they appear on the product page -`price` | ProductPrices | The price of an item. A `ProductPrice` object is returned. See [ProductPrices](#ProductPrices) for more information. -`product_links` | [ProductLinksInterface] | An array of [ProductLinks](#ProductLinks) objects -`related_products` | [[ProductInterface](#ProductInterface)] | An array of related products -`short_description` | ComplexTextValue | An object that contains a short description of the product. Its use depends on the store's theme. The object can include simple HTML tags -`sku` | String | A number or code assigned to a product to identify the product, options, price, and manufacturer -`small_image` | [ProductImage](#ProductImage) | An object that contains the URL and label for the small image used on catalog pages -`special_from_date` | String | The beginning date that a product has a special price -`special_price` | Float | The discounted price of the product -`special_to_date` | String | The end date that a product has a special price -`stock_status` | ProductStockStatus | The status of the stock. `ProductStockStatus` is an enumeration that can have the value of `IN_STOCK` or `OUT_OF_STOCK`. This attribute is defined in the `InventoryGraphQl` module. -`swatch_image` | String | The file name of a swatch image. This attribute is defined in the `SwatchesGraphQl` module. -`tax_class_id` | Int | An ID assigned to a tax class. This attribute is defined in the `TaxGraphQl` module. -`thumbnail` | [ProductImage](#ProductImage) | An object that contains the URL and label for the product's thumbnail image -`tier_price` | Float | The price when tier pricing is in effect and the items purchased threshold has been reached -`tier_prices` | [ProductTierPrices] | An array of [ProductTierPrices](#ProductTier) objects -`type_id` | String | One of `simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable` -`updated_at` | String | The timestamp indicating when the product was last updated -`upsell_products` | [[ProductInterface](#ProductInterface)] | An array of up-sell products -`url_key` | String | The part of the URL that identifies the product. This attribute is defined in the `CatalogUrlRewriteGraphQl` module -`url_path` | String | Deprecated. Use `canonical_url` instead -`url_rewrites` | [[UrlRewrite]](#urlRewriteObject) | A list of URL rewrites. See [UrlRewrite object](#urlRewriteObject) for more information and an [example query](#urlRewriteExample) -`websites` | [Website] | An array of websites in which the product is available. See [Website object](#websiteObject) for more information and an [example query](#inclWebsiteInfoExample) - -### ProductPrices object {#ProductPrices} - -The `ProductPrices` object contains the regular price of an item, as well as its minimum and maximum prices. Only composite products, which include bundle, configurable, and grouped products, can contain a minimum and maximum price. - -Attribute | Data Type | Description ---- | --- | --- -`maximalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the highest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "to" value. -`minimalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the lowest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "from" value. -`regularPrice` | Price | The base price of a product. - -#### Price object {#Price} - -The `Price` object defines the price of a product as well as any tax-related adjustments. - -Attribute | Data Type | Description ---- | --- | --- -`amount` | Money | The price of the product and its currency code. See [Money object](#Money). -`adjustments` | [PriceAdjustment] | An array of [PriceAdjustment](#PriceAdjustment) objects. - -##### Money object {#Money} - -A `Money` object defines a monetary value, including a numeric value and a currency code. - -Attribute | Data Type | Description ---- | --- | --- -`currency` | CurrencyEnum | A three-letter currency code, such as `USD` or `EUR`. -`value` | Float | The price of the product - -##### PriceAdjustment array {#PriceAdjustment} - -The `PricedAdjustment` object defines the amount of money to apply as an adjustment, the type of adjustment to apply, and whether the item is included or excluded from the adjustment. - -Attribute | Data Type | Description ---- | --- | --- -`amount` | Money | The amount of the price adjustment and its currency code. See [Money object](#Money). -`code` | PriceAdjustmentCodesEnum | One of `tax`, `weee`, or `weee_tax`. -`description` | PriceAdjustmentDescriptionEnum | Indicates whether the entity described by the code attribute is included or excluded from the adjustment. - -#### ProductLinks object {#ProductLinks} - -`ProductLinks` contains information about linked products, including the link type and product type of each item. - -Attribute | Type | Description ---- | --- | --- -`link_type` | String | One of `related`, `associated`, `upsell`, or `crosssell`. -`linked_product_sku` | String | The SKU of the linked product -`linked_product_type` | String | The type of linked product (`simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable`) -`position` | Int | The position within the list of product links -`sku` | String | The identifier of the linked product - -### MediaGalleryInterface {#MediaGalleryInterface} - -The `MediaGalleryInterface` contains basic information about a product image or video. - -Attribute | Type | Description ---- | --- | --- -`label` | String | The label for the product image or video -`url` | String | The URL for the product image or video - -### ProductImage object {#ProductImage} - -`ProductImage` implements [`MediaGalleryInterface`](#MediaGalleryInterface), which contains information about an image's URL and label. - -### ProductVideo object {#ProductVideo} - -`ProductVideo` implements [`MediaGalleryInterface`](#MediaGalleryInterface) and contains information about a product video. - -Attribute | Type | Description ---- | --- | --- -`video_content` | ProductMediaGalleryEntriesVideoContent | Contains a [ProductMediaGalleryEntriesVideoContent](#ProductMediaGalleryEntriesVideoContent) object - -### MediaGalleryEntry object {#MediaGalleryEntry} - -`MediaGalleryEntry` defines characteristics about images and videos associated with a specific product. - -Attribute | Type | Description ---- | --- | --- -`content` | ProductMediaGalleryEntriesContent | Contains a [ProductMediaGalleryEntriesContent](#ProductMediaGalleryEntriesContent) object -`disabled` | Boolean | Whether the image is hidden from view -`file` | String | The path of the image on the server -`id` | Int | The identifier assigned to the object -`label` | String | The "alt" text displayed on the UI when the user points to the image -`media_type` | String | `image` or `video` -`position` | Int | The media item's position after it has been sorted -`types` | [String] | Array of image types. It can have the following values: `image`, `small_image`, `thumbnail` -`video_content` | ProductMediaGalleryEntriesVideoContent | Contains a [ProductMediaGalleryEntriesVideoContent](#ProductMediaGalleryEntriesVideoContent) object - -#### ProductMediaGalleryEntriesContent object {#ProductMediaGalleryEntriesContent} - -`ProductMediaGalleryEntriesContent` contains an image in base64 format and basic information about the image. - -Attribute | Type | Description ---- | --- | --- -`base64_encoded_data` | String | The image in base64 format -`name` | String | The file name of the image -`type` | String | The MIME type of the file, such as `image/png` - -#### ProductMediaGalleryEntriesVideoContent object {#ProductMediaGalleryEntriesVideoContent} - -`ProductMediaGalleryEntriesVideoContent` contains a link to a video file and basic information about the video. - -Attribute | Type | Description ---- | --- | --- -`media_type` | String | Must be `external-video` -`video_description` | String | A description of the video -`video_metadata` | String | Optional data about the video -`video_provider` | String | Optionally describes the video source -`video_title` | String | The title of the video -`video_url` | String | The URL to the video - -### ProductTierPrices object {#ProductTier} - -The `ProductTierPrices` object defines a tier price, which is a quantity discount offered to a specific customer group. - -Attribute | Type | Description ---- | --- | --- -`customer_group_id` | Int | The ID of the customer group -`percentage_value` | Float | The percentage discount of the item -`qty` | Float | The number of items that must be purchased to qualify for tier pricing -`value` | Float | The price of the fixed price item -`website_id` | Int | The ID assigned to the website - -## PhysicalProductInterface {#PhysicalProductInterface} - -`PhysicalProductInterface`defines the weight of all tangible products. - -Attribute | Type | Description ---- | --- | --- -`weight` | Float | The weight of the item, in units defined by the store - -## LayerFilter object - -The `LayerFilter` object can be returned in a response to help create layered navigation on your app. - -Attribute | Type | Description ---- | --- | --- -`filter_items` | [LayerFilterItemInterface] | An array of filter items -`filter_items_count` | Int | The number of filter items in filter group -`name` | String | The layered navigation filter name -`request_var` | String | The request variable name for the filter query - -### LayerFilterItemInterface - -`LayerFilterItemInterface` contains an array of items that match the terms defined in the filter. - -Attribute | Type | Description ---- | --- | --- -`items_count` | Int | The number of items the filter returned -`label` | String | The label applied to a filter -`value_string` | String | The value for filter request variable to be used in a query - -## SortFields object - -The `SortFields` object contains the default value for sort fields as well as all possible sort fields. - -Attribute | Type | Description ---- | --- | --- -`default` | String | The default sort field -`options` | `SortField` | An array that contains all the fields you can use for sorting - -### SortField object - -Attribute | Type | Description ---- | --- | --- -`label` | String | The attribute's label -`value` | String | The attribute name or code to use as the sort field - -### Website object {#websiteObject} - -Use the `Website` attributes to retrieve information about the website's configuration, which includes the website name, website code, and default group ID. - -Attribute | Data Type | Description ---- | --- | --- -`code` | String | A code assigned to the website to identify it -`default_group_id` | String | The default group ID that the website has -`id` | Integer | The ID number assigned to the store -`name` | String | The website name. Websites use this name to identify it easier. -`sort_order` | Integer | The attribute to use for sorting websites - -### UrlRewrite object {#urlRewriteObject} - -The `products` query can request details about the `UrlRewrite` object. - -Attribute | Type | Description ---- | --- | --- -`parameters` | [[`HttpQueryParameter`]](#HttpQueryParameter) | An array of target path parameters -`url` | String | The request URL - -### HTTPQueryParameter object {#HttpQueryParameter} - -The `HttpQueryParameter` object provides details about target path parameters. - -Attribute | Type | Description ---- | --- | --- -`name` | String | The parameter name, such as `id` -`value` | String | The value assigned to the parameter ## Sample query -You can review several general interest `products` queries at [Queries]({{ page.baseurl }}/graphql/queries.html). +You can review several general interest `products` queries at [Queries]({{ page.baseurl }}/graphql/queries/index.html). ### Layered navigation diff --git a/guides/v2.3/graphql/release-notes.md b/guides/v2.3/graphql/release-notes.md index 91477d86108..a7c08ca9079 100644 --- a/guides/v2.3/graphql/release-notes.md +++ b/guides/v2.3/graphql/release-notes.md @@ -70,7 +70,7 @@ These release notes can include: - Mutations that [generate]({{page.baseurl}}/graphql/mutations/generate-customer-token.html) and [revoke]({{page.baseurl}}/graphql/mutations/revoke-customer-token.html) customer tokens - Page Builder and WYSIWYG fields support complex structures for PWA scenarios - Magento now calculates the complexity of queries and mutations and returns an error message if a query or mutation is deemed too complex - - Variable support in [queries]({{page.baseurl}}/graphql/queries.html) and [mutations]({{page.baseurl}}/graphql/mutations.html) + - Variable support in [queries]({{page.baseurl}}/graphql/queries/index.html) and [mutations]({{page.baseurl}}/graphql/mutations/index.html) - A query that returns information about a store's [theme and CMS]({{page.baseurl}}/graphql/queries/store-config.html) configuration - GraphQL tests are integrated with Travis CI​ - GraphQL browsers now display fields and objects alphabetically From c6c1bea2ed6911a8ca18ad61ecab38656b48a636 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Sat, 28 Sep 2019 18:07:24 -0500 Subject: [PATCH 2/5] move mutation topic and first phase of products reorg --- _data/toc/graphql.yml | 3 + .../{mutations.md => mutations/index.md} | 4 +- guides/v2.3/graphql/queries/index.md | 446 +---------------- guides/v2.3/graphql/queries/products.md | 452 +++++++++++++++++- 4 files changed, 444 insertions(+), 461 deletions(-) rename guides/v2.3/graphql/{mutations.md => mutations/index.md} (98%) diff --git a/_data/toc/graphql.yml b/_data/toc/graphql.yml index 79c65efa7bd..0e97987ec9d 100644 --- a/_data/toc/graphql.yml +++ b/_data/toc/graphql.yml @@ -219,6 +219,9 @@ pages: - label: Product interface implementations url: /graphql/product/product-interface-implementations.html + - label: ProductInterface attributes + url: /graphql/product/product-interface.html + - label: CustomizableOptionInterface url: /graphql/product/customizable-option-interface.html diff --git a/guides/v2.3/graphql/mutations.md b/guides/v2.3/graphql/mutations/index.md similarity index 98% rename from guides/v2.3/graphql/mutations.md rename to guides/v2.3/graphql/mutations/index.md index 4dba0b5005a..c1122c8cacb 100644 --- a/guides/v2.3/graphql/mutations.md +++ b/guides/v2.3/graphql/mutations/index.md @@ -1,6 +1,8 @@ --- group: graphql -title: Mutations +title: Using mutations +redirect_from: + - /guides/v2.3/graphql/mutations.html --- While GraphQL queries perform read operations, mutations change the data. A mutation can create, update, or delete objects and fields. In REST terminology, queries operate like `GET` requests, while mutations are similar to `POST`, `PUT`, and `DELETE`. diff --git a/guides/v2.3/graphql/queries/index.md b/guides/v2.3/graphql/queries/index.md index 5f6d1eebf79..cb65c57fdd2 100644 --- a/guides/v2.3/graphql/queries/index.md +++ b/guides/v2.3/graphql/queries/index.md @@ -3,6 +3,7 @@ group: graphql title: Queries redirect_from: - /guides/v2.3/graphql/search-pagination.html + - /guides/v2.3/graphql/queries.html --- A GraphQL query retrieves data from the Magento server in a similar manner as a REST GET call. The current set of Magento GraphQL queries allow a mobile app or browser to render a wide variety of information, including the following: @@ -270,448 +271,3 @@ query IntrospectionQuery { } ``` -## Product search queries - -A product search query can contain the following components: - -* A full text search keyword -* Filters (search criteria) -* Pagination information -* Sorting instructions - -### Specifying full text search keywords - -The `search` element causes Magento to perform a full text search on the specified keywords. (This is the same type of search that is performed from the storefront. If multiple keywords are specified, each keyword is evaluated separately.) - -The `search` element is optional, but it can be used with or without filters. Each query must contain a `search` or `filter` element. - -### Specifying filters - -The `filter` element defines which search criteria to use to find the desired results. As with a REST call, each filter defines the field to be searched, the condition type, and the search value. - -Search filters are logically ANDed unless an `or` statement is specified. The search query can contain unlimited number of nested `or` clauses. However, you cannot perform a logical `or` across two AND clauses, such as (A AND B) OR (X AND Y). - -#### Search fields - -Each object type defines which fields can be searched. See the object-specific documentation for details. - -{:.bs-callout-info} -You cannot specify the same search field twice in a GraphQL query. - -#### Condition types and search values - -The following table lists available condition types and provides the SQL statement equivalents. - -Magento GraphQL clause | SQL equivalent ---- | --- -`eq: "value"` | field = 'value' -`neq: "value"` |field != 'value' -`like: "value%"` | field LIKE 'value%' -`nlike: "value%"` |field NOT LIKE 'value%' -`in: [1, 2, 3]` | field IN (1, 2, 3) -`nin: [1, 2, 3]` | field NOT IN (1, 2, 3) -`notnull: true` | field IS NOT NULL -`null: true` | field IS NULL -`lt: "value"` | field < 'value' -`gt: "value"` | field > 'value' -`gteq: "value"` | field >= 'value' -`lteq: "value"` | field <= 'value' -`moreq: "value"` | field >= 'value' -`from: "value1"` `to: "value2"` | field BETWEEN 'value1' AND 'value2' - -`to` and `from` must always be used together. These condition types can be used in the same search term. For example, `quantity: {from: "10" to: "20"}`. - -`gt` and `lt` can be used in the same search term. For example, `quantity: {gt: "10" lt: "20"}`. - -### Specifying pagination - -Magento's GraphQL implementation of pagination uses offsets so that it operates in the same manner as REST and SOAP API requests. - -The `pageSize` attribute specifies the maximum number of items to return. If no value is specified, 20 items are returned. - -The `currentPage` attribute specifies which page of results to return. If no value is specified, the first page is returned. If you specify a value that is greater than the number of available pages, an error is returned. - -You can include the `total_pages` attribute in the `page_info` section of the output definition to indicate how many pages were returned for the query. - -### Sorting instructions - -The `sort` object allows you to specify which field or fields to use for sorting the results. If you specify more than one field, Magento sorts by the first field listed. Then, if any items have the same value, those items will be sorted by the secondary field. The value for each field can be set to either `ASC` or `DESC`. - -In the following example, Magento returns a list of items that are sorted in order of decreasing price. If two or more items have the same price, the items are listed in alphabetic order by name. - -```graphql -sort: { - price: DESC - name: ASC -} -``` - -### Example Product Searches - -The following sections provide examples of each type of search. These examples use the Magento Open Source sample data. - -#### Full text search - -The following search returns items that contain the word `yoga` or `pants`. The Catalog Search index contains search terms taken from the product `name`, `description`, `short_description` and related attributes. - -```graphql -{ - products( - search: "Yoga pants" - pageSize: 10 - ) - { - total_count - items { - name - sku - price { - regularPrice { - amount { - value - currency - } - } - } - } - page_info { - page_size - current_page - } - } -} -``` - -The search returns 45 items. - -#### Full text search with filters - -The following sample query returns a list of products that meets the following criteria: - -* The product name, product description, or related field contains the string `Messenger` (which causes it to be available for full text searches). -* The SKU begins with `24-MB` -* The price is less than $50. - -The response for each item includes the `name`, `sku`, `price` and `description` only. Up to 25 results are returned at a time, in decreasing order of price. - -```graphql -{ - products( - search: "Messenger" - filter: { - sku: { - like: "24-MB%" - } - price: { - lt: "50" - } - } - pageSize: 25 - sort: { - price: DESC - } - ) - { - items { - name - sku - description { - html - } - price { - regularPrice { - amount { - value - currency - } - } - } - } - total_count - page_info { - page_size - } - } -} -``` - -The query returns the following: - -```json -{ - "data": { - "products": { - "items": [ - { - "name": "Wayfarer Messenger Bag", - "sku": "24-MB05", - "description": { - "html": "

Perfect for class, work or the gym, the Wayfarer Messenger Bag is packed with pockets. The dual-buckle flap closure reveals an organizational panel, and the roomy main compartment has spaces for your laptop and a change of clothes. An adjustable shoulder strap and easy-grip handle promise easy carrying.

\n
    \n
  • Multiple internal zip pockets.
  • \n
  • Made of durable nylon.
  • \n
" - }, - "price": { - "regularPrice": { - "amount": { - "value": 45, - "currency": "USD" - } - } - } - }, - { - "name": "Rival Field Messenger", - "sku": "24-MB06", - "description": { - "html": "

The Rival Field Messenger packs all your campus, studio or trail essentials inside a unique design of soft, textured leather - with loads of character to spare. Two exterior pockets keep all your smaller items handy, and the roomy interior offers even more space.

\n
    \n
  • Leather construction.
  • \n
  • Adjustable fabric carry strap.
  • \n
  • Dimensions: 18\" x 10\" x 4\".
  • \n
" - }, - "price": { - "regularPrice": { - "amount": { - "value": 45, - "currency": "USD" - } - } - } - } - ], - "total_count": 2, - "page_info": { - "page_size": 25 - } - } - } -} -``` - -#### Simple search using a timestamp - -The following search finds all products that were added after the specified time (midnight, November 1, 2017). - -```graphql -{ - products( - filter: { - created_at: { - gt: "2017-11-01 00:00:00" - } - } - pageSize: 25 - sort: { - price: DESC - } - ) - { - total_count - items { - name - sku - price { - regularPrice { - amount { - value - currency - } - } - } - } - page_info { - page_size - current_page - } - } -} -``` - -#### Simple Logical OR search - -The following example searches for all products whose `sku` begins with the string `24-MB` or whose `name` ends with `Bag`. - -```graphql -{ - products( - filter: { - or: { - sku: { - like: "24-MB%" - } - name: { - like: "%Bag" - } - } - } - pageSize: 25 - sort: { - price: DESC - } - ) - { - total_count - items { - name - sku - price { - regularPrice { - amount { - value - currency - } - } - } - } - page_info { - page_size - current_page - } - } -} -``` - -The query returns 8 items. - -#### Logical AND and OR search - -This query searches for products that have `name` that ends with `Short` or has a `sku` that indicates the product is a pair of women’s pants (`WP%`). The system performs a logical AND to restrict the results to those that cost from $40 to $49.99. - -```graphql -{ - products( - filter: { - price: { - from: "40" to: "49.99" - } - or: { - name: { - like: "%Short" - } - sku: { - like: "WP%" - } - } - } - pageSize: 25 - sort: { - price: DESC - } - ) - { - total_count - items { - name - sku - price { - regularPrice { - amount { - value - } - } - } - } - page_info { - page_size - current_page - } - } -} -``` - -The query returns 14 items. - -#### Retrieve related products, Up-sells and Cross-sells - -The following query shows how to get related products, Up-sells and Cross-sells for the particular product: - -```text -{ - products(filter: { sku: { eq: "24-WB06" } }) { - items { - id - name - related_products { - id - name - } - upsell_products { - id - name - } - crosssell_products { - id - name - } - } - } -} -``` - -**Response** - -```json -{ - "data": { - "products": { - "items": [ - { - "id": 11, - "name": "Endeavor Daytrip Backpack", - "related_products": [], - "upsell_products": [ - { - "id": 1, - "name": "Joust Duffle Bag" - }, - { - "id": 3, - "name": "Crown Summit Backpack" - }, - { - "id": 4, - "name": "Wayfarer Messenger Bag" - }, - { - "id": 5, - "name": "Rival Field Messenger" - }, - { - "id": 6, - "name": "Fusion Backpack" - }, - { - "id": 7, - "name": "Impulse Duffle" - }, - { - "id": 12, - "name": "Driven Backpack" - }, - { - "id": 13, - "name": "Overnight Duffle" - }, - { - "id": 14, - "name": "Push It Messenger Bag" - } - ], - "crosssell_products": [ - { - "id": 18, - "name": "Pursuit Lumaflex™ Tone Band" - }, - { - "id": 21, - "name": "Sprite Foam Yoga Brick" - }, - { - "id": 32, - "name": "Sprite Stasis Ball 75 cm" - }, - { - "id": 45, - "name": "Set of Sprite Yoga Straps" - } - ] - } - ] - } - } -} -``` diff --git a/guides/v2.3/graphql/queries/products.md b/guides/v2.3/graphql/queries/products.md index c628b553ab9..9f22d448aa6 100644 --- a/guides/v2.3/graphql/queries/products.md +++ b/guides/v2.3/graphql/queries/products.md @@ -19,6 +19,8 @@ products( ): Products ``` +## Input attributes + Each query attribute is defined below: Attribute | Description @@ -28,11 +30,17 @@ Attribute | Description `pageSize` | Specifies the maximum number of results to return at once. The default value is 20. See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information. `currentPage` | Specifies which page of results to return. The default value is 1. See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information. `sort` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information. -`Products` | An output object that contains the results of the query. See [Response](#Response) for details. +`Products` | An output object that contains the results of the query. See [Output attributes](#Response) for details. + +### search attribute + +The `search` element causes Magento to perform a full text search on the specified keywords. (This is the same type of search that is performed from the storefront.) If multiple keywords are specified, each keyword is evaluated separately. + +The `search` element is optional, but it can be used with or without filters. Each query must contain a `search` or `filter` element. -## ProductFilterInput object {#ProductFilterInput} +### filter attribute -The `ProductFilterInput` object defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for. The following example filter searches for products that has a `sku` that contains the string `24-MB` with a `price` that's less than `50`. +'The `ProductFilterInput` object defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for. The following example filter searches for products that has a `sku` that contains the string `24-MB` with a `price` that's less than `50`. ``` text filter: { @@ -45,11 +53,11 @@ filter: { } ``` -See [Queries]({{ page.baseurl }}/graphql/queries/index.html) for more information about the operators. +Search filters are logically ANDed unless an `or` statement is specified. The search query can contain unlimited number of nested `or` clauses. However, you cannot perform a logical `or` across two AND clauses, such as (A AND B) OR (X AND Y). Magento processes the attribute values specified in a `ProductFilterInput` as simple data types (strings, integers, booleans). However, returned attributes can be a different, complex, data type. For example, in a response, `price` is an object that contains a monetary value and a currency code. -The following attributes can be used to create filters. See the [Response](#Response) section for information about each attribute. +The following attributes can be used to create filters. See the [Output attributes](#Response) section for information about each attribute. ```text category_id @@ -109,7 +117,55 @@ content="GraphQL automatically filters out a product attribute if ALL of the fol %} -## Response {#Response} +#### Condition types and search values + +The following table lists available condition types and provides the SQL statement equivalents. + +Magento GraphQL clause | SQL equivalent +--- | --- +`eq: "value"` | field = 'value' +`neq: "value"` |field != 'value' +`like: "value%"` | field LIKE 'value%' +`nlike: "value%"` |field NOT LIKE 'value%' +`in: [1, 2, 3]` | field IN (1, 2, 3) +`nin: [1, 2, 3]` | field NOT IN (1, 2, 3) +`notnull: true` | field IS NOT NULL +`null: true` | field IS NULL +`lt: "value"` | field < 'value' +`gt: "value"` | field > 'value' +`gteq: "value"` | field >= 'value' +`lteq: "value"` | field <= 'value' +`moreq: "value"` | field >= 'value' +`from: "value1"` `to: "value2"` | field BETWEEN 'value1' AND 'value2' + +`to` and `from` must always be used together. These condition types can be used in the same search term. For example, `quantity: {from: "10" to: "20"}`. + +`gt` and `lt` can be used in the same search term. For example, `quantity: {gt: "10" lt: "20"}`. + +### pageSize attribute {#pageSize} + +Magento's GraphQL implementation of pagination uses offsets so that it operates in the same manner as REST and SOAP API requests. + +The `pageSize` attribute specifies the maximum number of items to return. If no value is specified, 20 items are returned. + +### currentPage attribute + +The `currentPage` attribute specifies which page of results to return. If no value is specified, the first page is returned. Magento returns an error if you specify a value that is greater than the number of available pages. + +### sort attribute + +The `sort` object allows you to specify which field or fields to use for sorting the results. If you specify more than one field, Magento sorts by the first field listed. Then, if any items have the same value, those items will be sorted by the secondary field. The value for each field can be set to either `ASC` or `DESC`. + +In the following example, Magento returns a list of items that are sorted in order of decreasing price. If two or more items have the same price, the items are listed in alphabetic order by name. + +```graphql +sort: { + price: DESC + name: ASC +} +``` + +## Output attributes {#Response} The system returns a `Products` object containing the following information: @@ -123,13 +179,13 @@ sort_fields: SortFields Each attribute is described below: -Attribute | Description ---- | --- -`filters` | An array of layered navigation filters. These filters can be used to implement layered navigation on your app. -`items` | An array of products that match the specified search criteria. -`page_info` | An object that includes the `page_info` and `currentPage` values specified in the query -`sort_fields` | An object that includes the default sort field and all available sort fields -`total_count` | The number of products returned +Attribute | Data type | Description +--- | --- | --- +`filters` | [LayerFilter] | An array of layered navigation filters. These filters can be used to implement layered navigation on your app. +`items` | [ProductInterface] | An array of products that match the specified search criteria. +`page_info` | SearchResultPageInfo | An object that includes the `page_info` and `currentPage` values specified in the query +`sort_fields` | SortFields | An object that includes the default sort field and all available sort fields +`total_count` | Int | The number of products returned When a product requires a filter attribute that is not a field on its output schema, inject the attribute name into the class in a module's `di.xml` file. @@ -147,9 +203,375 @@ When a product requires a filter attribute that is not a field on its output sch This example adds `field_to_sort` and `other_field_to_sort` attributes to the `additionalAttributes` array defined in the `ProductEntityAttributesForAst` class. The array already contains the `min_price`, `max_price`, and `category_ids` attributes. -## Sample query +## Sample queries + + +### Full text search + +The following search returns items that contain the word `yoga` or `pants`. The Catalog Search index contains search terms taken from the product `name`, `description`, `short_description` and related attributes. + +```graphql +{ + products( + search: "Yoga pants" + pageSize: 10 + ) + { + total_count + items { + name + sku + price { + regularPrice { + amount { + value + currency + } + } + } + } + page_info { + page_size + current_page + } + } +} +``` + +The search returns 45 items. + +### Full text search with filters + +The following sample query returns a list of products that meets the following criteria: + +* The product name, product description, or related field contains the string `Messenger` (which causes it to be available for full text searches). +* The SKU begins with `24-MB` +* The price is less than $50. + +The response for each item includes the `name`, `sku`, `price` and `description` only. Up to 25 results are returned at a time, in decreasing order of price. + +```graphql +{ + products( + search: "Messenger" + filter: { + sku: { + like: "24-MB%" + } + price: { + lt: "50" + } + } + pageSize: 25 + sort: { + price: DESC + } + ) + { + items { + name + sku + description { + html + } + price { + regularPrice { + amount { + value + currency + } + } + } + } + total_count + page_info { + page_size + } + } +} +``` + +The query returns the following: + +```json +{ + "data": { + "products": { + "items": [ + { + "name": "Wayfarer Messenger Bag", + "sku": "24-MB05", + "description": { + "html": "

Perfect for class, work or the gym, the Wayfarer Messenger Bag is packed with pockets. The dual-buckle flap closure reveals an organizational panel, and the roomy main compartment has spaces for your laptop and a change of clothes. An adjustable shoulder strap and easy-grip handle promise easy carrying.

\n
    \n
  • Multiple internal zip pockets.
  • \n
  • Made of durable nylon.
  • \n
" + }, + "price": { + "regularPrice": { + "amount": { + "value": 45, + "currency": "USD" + } + } + } + }, + { + "name": "Rival Field Messenger", + "sku": "24-MB06", + "description": { + "html": "

The Rival Field Messenger packs all your campus, studio or trail essentials inside a unique design of soft, textured leather - with loads of character to spare. Two exterior pockets keep all your smaller items handy, and the roomy interior offers even more space.

\n
    \n
  • Leather construction.
  • \n
  • Adjustable fabric carry strap.
  • \n
  • Dimensions: 18\" x 10\" x 4\".
  • \n
" + }, + "price": { + "regularPrice": { + "amount": { + "value": 45, + "currency": "USD" + } + } + } + } + ], + "total_count": 2, + "page_info": { + "page_size": 25 + } + } + } +} +``` + +### Simple search using a timestamp + +The following search finds all products that were added after the specified time (midnight, November 1, 2017). + +```graphql +{ + products( + filter: { + created_at: { + gt: "2017-11-01 00:00:00" + } + } + pageSize: 25 + sort: { + price: DESC + } + ) + { + total_count + items { + name + sku + price { + regularPrice { + amount { + value + currency + } + } + } + } + page_info { + page_size + current_page + } + } +} +``` + +### Simple Logical OR search + +The following example searches for all products whose `sku` begins with the string `24-MB` or whose `name` ends with `Bag`. + +```graphql +{ + products( + filter: { + or: { + sku: { + like: "24-MB%" + } + name: { + like: "%Bag" + } + } + } + pageSize: 25 + sort: { + price: DESC + } + ) + { + total_count + items { + name + sku + price { + regularPrice { + amount { + value + currency + } + } + } + } + page_info { + page_size + current_page + } + } +} +``` + +The query returns 8 items. + +### Logical AND and OR search + +This query searches for products that have `name` that ends with `Short` or has a `sku` that indicates the product is a pair of women’s pants (`WP%`). The system performs a logical AND to restrict the results to those that cost from $40 to $49.99. + +```graphql +{ + products( + filter: { + price: { + from: "40" to: "49.99" + } + or: { + name: { + like: "%Short" + } + sku: { + like: "WP%" + } + } + } + pageSize: 25 + sort: { + price: DESC + } + ) + { + total_count + items { + name + sku + price { + regularPrice { + amount { + value + } + } + } + } + page_info { + page_size + current_page + } + } +} +``` + +The query returns 14 items. + +### Retrieve related products, Up-sells and Cross-sells + +The following query shows how to get related products, Up-sells and Cross-sells for the particular product: + +```text +{ + products(filter: { sku: { eq: "24-WB06" } }) { + items { + id + name + related_products { + id + name + } + upsell_products { + id + name + } + crosssell_products { + id + name + } + } + } +} +``` + +**Response** + +```json +{ + "data": { + "products": { + "items": [ + { + "id": 11, + "name": "Endeavor Daytrip Backpack", + "related_products": [], + "upsell_products": [ + { + "id": 1, + "name": "Joust Duffle Bag" + }, + { + "id": 3, + "name": "Crown Summit Backpack" + }, + { + "id": 4, + "name": "Wayfarer Messenger Bag" + }, + { + "id": 5, + "name": "Rival Field Messenger" + }, + { + "id": 6, + "name": "Fusion Backpack" + }, + { + "id": 7, + "name": "Impulse Duffle" + }, + { + "id": 12, + "name": "Driven Backpack" + }, + { + "id": 13, + "name": "Overnight Duffle" + }, + { + "id": 14, + "name": "Push It Messenger Bag" + } + ], + "crosssell_products": [ + { + "id": 18, + "name": "Pursuit Lumaflex™ Tone Band" + }, + { + "id": 21, + "name": "Sprite Foam Yoga Brick" + }, + { + "id": 32, + "name": "Sprite Stasis Ball 75 cm" + }, + { + "id": 45, + "name": "Set of Sprite Yoga Straps" + } + ] + } + ] + } + } +} +``` -You can review several general interest `products` queries at [Queries]({{ page.baseurl }}/graphql/queries/index.html). ### Layered navigation From 30f18d50a8bb1289ba1bb3f859304ba5472e35d2 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Mon, 30 Sep 2019 16:01:36 -0500 Subject: [PATCH 3/5] sweep through query topics --- _includes/graphql/cart-object.md | 8 +- guides/v2.3/graphql/product/bundle-product.md | 2 +- .../v2.3/graphql/product/grouped-product.md | 2 +- .../product-interface-implementations.md | 12 +- .../v2.3/graphql/product/product-interface.md | 6 +- guides/v2.3/graphql/queries/cart.md | 2 +- guides/v2.3/graphql/queries/category.md | 146 +++++++++--------- .../graphql/queries/checkout-agreements.md | 2 +- guides/v2.3/graphql/queries/cms-blocks.md | 2 +- guides/v2.3/graphql/queries/cms-page.md | 5 +- .../queries/custom-attribute-metadata.md | 4 +- .../graphql/queries/directory-countries.md | 2 +- .../v2.3/graphql/queries/directory-country.md | 2 +- .../graphql/queries/directory-currency.md | 2 +- .../graphql/queries/get-payflow-link-token.md | 2 +- .../v2.3/graphql/queries/giftcard-account.md | 2 +- guides/v2.3/graphql/queries/products.md | 11 +- guides/v2.3/graphql/queries/wishlist.md | 2 +- 18 files changed, 106 insertions(+), 108 deletions(-) diff --git a/_includes/graphql/cart-object.md b/_includes/graphql/cart-object.md index 715cee78509..e40fb0ea36f 100644 --- a/_includes/graphql/cart-object.md +++ b/_includes/graphql/cart-object.md @@ -3,13 +3,13 @@ Attribute | Data Type | Description `applied_coupon` | [`AppliedCoupon`][AppliedCoupon] | The `AppliedCoupon` object contains the `code` text attribute, which specifies the coupon code `applied_gift_cards` | [[`AppliedGiftCard`]][AppliedGiftCard] | An array of `AppliedGiftCard` objects. An `AppliedGiftCard` object contains the `code` text attribute, which specifies the gift card code. `applied_gift_cards` is a Commerce-only attribute, defined in the GiftCardAccountGraphQl module `applied_store_credit` | [`AppliedStoreCredit`][AppliedStoreCredit] | Contains store credit information applied to the cart. `applied_store_credit` is a Commerce-only attribute, defined in the CustomerBalanceGraphQl module -`available_payment_methods` | [AvailablePaymentMethod][AvailablePaymentMethod] | Available payment methods -`billing_address` | [BillingCartAddress][BillingCartAddress] | Contains the billing address specified in the customer's cart +`available_payment_methods` | [[AvailablePaymentMethod]][AvailablePaymentMethod] | Available payment methods +`billing_address` | [BillingCartAddress][BillingCartAddress]! | Contains the billing address specified in the customer's cart `email` | String | The customer's email address -`items` | [CartItemInterface][CartItemInterface] | Contains the items in the customer's cart +`items` | [[CartItemInterface]][CartItemInterface] | Contains the items in the customer's cart `prices` | [CartPrices][CartPrices] | Contains subtotals and totals `selected_payment_method` | [SelectedPaymentMethod][SelectedPaymentMethod] | Selected payment method -`shipping_addresses` | [ShippingCartAddress][ShippingCartAddress] | Contains one or more shipping addresses +`shipping_addresses` | [[ShippingCartAddress]][ShippingCartAddress]! | Contains one or more shipping addresses [AppliedCoupon]: {{page.baseurl}}/graphql/queries/cart.html#AppliedCoupon [AppliedGiftCard]: {{page.baseurl}}/graphql/queries/cart.html#AppliedGiftCard diff --git a/guides/v2.3/graphql/product/bundle-product.md b/guides/v2.3/graphql/product/bundle-product.md index 179a1d94bb2..59fbba7ab95 100644 --- a/guides/v2.3/graphql/product/bundle-product.md +++ b/guides/v2.3/graphql/product/bundle-product.md @@ -53,7 +53,7 @@ Attribute | Type | Description `position` | Int | When a bundle item contains multiple options, the relative position of this option compared to the other options `price_type` | PriceTypeEnum | One of FIXED, PERCENT, or DYNAMIC `price` | Float | The price of the selected option -`product` | [ProductInterface]({{page.baseurl}}/graphql/queries/products.html#ProductInterface) | Contains details about this product option +`product` | [ProductInterface]({{page.baseurl}}/graphql/product/product-interface.html) | Contains details about this product option `qty` | Float | Deprecated. Use `quantity` instead `quantity` | Float | Indicates the quantity of this specific bundle item diff --git a/guides/v2.3/graphql/product/grouped-product.md b/guides/v2.3/graphql/product/grouped-product.md index ab8412574d7..57712edc088 100644 --- a/guides/v2.3/graphql/product/grouped-product.md +++ b/guides/v2.3/graphql/product/grouped-product.md @@ -22,7 +22,7 @@ The `GroupedProductItem` object contains the following attributes: Attribute | Type | Description --- | --- | --- `position` | Int | The relative position of this item compared to the other group items -`product` | [ProductInterface]{{ page.baseurl }}/graphql/queries/products.html#ProductInterface | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes +`product` | [ProductInterface]{{ page.baseurl }}/graphql/product/product-interface.html | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes `qty` | Float | The quantity of this grouped product item ## Sample Query diff --git a/guides/v2.3/graphql/product/product-interface-implementations.md b/guides/v2.3/graphql/product/product-interface-implementations.md index 8846b57a0b4..47d7b912d18 100644 --- a/guides/v2.3/graphql/product/product-interface-implementations.md +++ b/guides/v2.3/graphql/product/product-interface-implementations.md @@ -9,12 +9,12 @@ Magento provides multiple product types, and most of these product types have sp Product type | Implements | Has product-specific attributes? --- | --- | --- -* [BundleProduct]({{ page.baseurl }}/graphql/reference/bundle-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes -* [ConfigurableProduct]({{ page.baseurl }}/graphql/product/configurable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes -* [DownloadableProduct]({{ page.baseurl }}/graphql/product/downloadable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes -* [GroupedProduct]({{ page.baseurl }}/graphql/product/grouped-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes -* SimpleProduct | [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | No -* VirtualProduct | [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | No +* [BundleProduct]({{ page.baseurl }}/graphql/reference/bundle-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes +* [ConfigurableProduct]({{ page.baseurl }}/graphql/product/configurable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes +* [DownloadableProduct]({{ page.baseurl }}/graphql/product/downloadable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes +* [GroupedProduct]({{ page.baseurl }}/graphql/product/grouped-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes +* SimpleProduct | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | No +* VirtualProduct | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | No ## Query for product-specific attributes diff --git a/guides/v2.3/graphql/product/product-interface.md b/guides/v2.3/graphql/product/product-interface.md index fa9adbfbbb8..f31f6e274d8 100644 --- a/guides/v2.3/graphql/product/product-interface.md +++ b/guides/v2.3/graphql/product/product-interface.md @@ -25,7 +25,7 @@ Attribute | Data type | Description `categories` | [CategoryInterface] | The categories assigned to the product. See [categories query]({{ page.baseurl }}/graphql/queries/category.html) for more information `country_of_manufacture` | String | The product's country of origin `created_at` | String | Timestamp indicating when the product was created -`crosssell_products` | [[ProductInterface](#ProductInterface)] | An array of cross-sell products +`crosssell_products` | [ProductInterface] | An array of cross-sell products `description` | ComplexTextValue | An object that contains detailed information about the product. The object can include simple HTML tags `gift_message_available` | String | Indicates whether a gift message is available `id` | Int | The ID number assigned to the product @@ -44,7 +44,7 @@ Attribute | Data type | Description `options_container` | String | If the product has multiple options, determines where they appear on the product page `price` | ProductPrices | The price of an item. A `ProductPrice` object is returned. See [ProductPrices](#ProductPrices) for more information. `product_links` | [ProductLinksInterface] | An array of [ProductLinks](#ProductLinks) objects -`related_products` | [[ProductInterface](#ProductInterface)] | An array of related products +`related_products` | [ProductInterface] | An array of related products `short_description` | ComplexTextValue | An object that contains a short description of the product. Its use depends on the store's theme. The object can include simple HTML tags `sku` | String | A number or code assigned to a product to identify the product, options, price, and manufacturer `small_image` | [ProductImage](#ProductImage) | An object that contains the URL and label for the small image used on catalog pages @@ -59,7 +59,7 @@ Attribute | Data type | Description `tier_prices` | [ProductTierPrices] | An array of [ProductTierPrices](#ProductTier) objects `type_id` | String | One of `simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable` `updated_at` | String | The timestamp indicating when the product was last updated -`upsell_products` | [[ProductInterface](#ProductInterface)] | An array of up-sell products +`upsell_products` | [ProductInterface] | An array of up-sell products `url_key` | String | The part of the URL that identifies the product. This attribute is defined in the `CatalogUrlRewriteGraphQl` module `url_path` | String | Deprecated. Use `canonical_url` instead `url_rewrites` | [[UrlRewrite]](#urlRewriteObject) | A list of URL rewrites. See [UrlRewrite object](#urlRewriteObject) for more information and an [example query](#urlRewriteExample) diff --git a/guides/v2.3/graphql/queries/cart.md b/guides/v2.3/graphql/queries/cart.md index d0ffbdaad23..452053ae57d 100644 --- a/guides/v2.3/graphql/queries/cart.md +++ b/guides/v2.3/graphql/queries/cart.md @@ -523,7 +523,7 @@ The `CartItemInterface` object can contain the following attributes. Attribute | Data Type | Description --- | --- | --- `id` | String | ID of the item -`product` | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface-implementations.html) | Contains attributes that are common to all types of products +`product` | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html) | Contains attributes that are common to all types of products `quantity` | Float | The number of items in the cart ### CartItemQuantity object {#CartItemQuantity} diff --git a/guides/v2.3/graphql/queries/category.md b/guides/v2.3/graphql/queries/category.md index f76c30292af..2b21d8f1d5a 100644 --- a/guides/v2.3/graphql/queries/category.md +++ b/guides/v2.3/graphql/queries/category.md @@ -7,88 +7,21 @@ redirect_from: The `category` query allows you to search for a single category definition or the entire category tree. To return multiple category levels in a single call, define the response so that it contains up to ten nested `children` options. You cannot return the entire category tree if it contains more than 10 sublevels unless the `queryDepth` parameter in the GraphQL `di.xml` file has been reconfigured. -## Query structure +## Syntax -``` text +```graphql category ( - id: int + id: int ): CategoryTree ``` -### Input attributes - -Attribute | Data type | Description ---- | --- | --- -`id` | Int | The category ID to use as the starting point of your category search. - -### Output attributes {#Categories} - -The query returns a `CategoryTree` object, which implements `CategoryInterface`. It can contain the following top-level attributes: - -Attribute | Data type | Description ---- | --- | --- -`breadcrumbs` | `Breadcrumb` | A `Breadcrumb` object contains information the categories that comprise the breadcrumb trail for the specified category -`children` | `CategoryTree` | A `CategoryTree` object that contains information about a child category. You can specify up to 10 levels of child categories. -`created_at`| String | Timestamp indicating when the category was created -`default_sort_by`| String | The attribute to use for sorting -`description`| String | An optional description of the category -`id` | Int | An ID that uniquely identifies the category -`level` | Int | Indicates the depth of the category within the tree -`name`| String | The display name of the category -`path_in_store`| String | Category path in the store -`path`| String | The path to the category, as a string of category IDs, separated by slashes (/). For example, `1/2/20` -`position`| Int | The position of the category relative to other categories at the same level in tree -`product_count`| Int | The number of products in the category -`products()` | `CategoryProducts` | The list of products assigned to the category -`updated_at`| String | Timestamp indicating when the category was updated -`url_key`| String | The url key assigned to the category -`url_path`| String | The url path assigned to the category - -#### CategoryProducts object - -The `products` attribute can contain the following attributes: - -Attribute | Data type | Description ---- | --- | --- -`currentPage` | Int | Specifies which page of results to return. The default value is 1. -`pageSize` | Int | Specifies the maximum number of results to return at once. This attribute is optional. The default value is 20. -`sort` | `ProductSortInput` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) describes sort orders. - -The `CategoryProducts` object contains the following attributes: - -Attribute | Data type | Description ---- | --- | --- -`items` | [ProductInterface] | An array of products that are assigned to the category. See [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface) for more information. -`page_info` | `SearchResultPageInfo` | An object that includes the `page_info` and `currentPage` values specified in the query -`total_count` | Int | The number of products returned - -#### Breadcrumb object - -A breadcrumb trail is a set of links that shows customers where they are in relation to other pages in the -store. - -Attribute | Data type | Description ---- | --- | --- -`category_id` | Int | An ID that uniquely identifies the category -`category_level` | Int | Indicates the depth of the category within the tree -`category_name` | String | The display name of the category -`category_url_key` | String | The url key assigned to the category - -#### CategoryTree object - -This `CategoryTree` object contains information about the next level of subcategories of the category specified in the original query. - -Attribute | Data type | Description ---- | --- | --- -`children` | [CategoryTree] | An array containing the next level of subcategories - -## Sample Queries +## Example Usage The following query returns information about category ID `20` and four levels of subcategories. In the sample data, category ID `20` is assigned to the "Women" category. **Request** -``` text +```graphql { category(id: 20) { products { @@ -209,7 +142,7 @@ The following query returns breadcrumb information about the women's tops catego **Request** -``` text +```graphql { category ( id: 25 @@ -254,3 +187,70 @@ The following query returns breadcrumb information about the women's tops catego } } ``` + +## Input attributes + +Attribute | Data type | Description +--- | --- | --- +`id` | Int | The category ID to use as the starting point of your category search + +## Output attributes {#Categories} + +The query returns a `CategoryTree` object, which implements `CategoryInterface`. It can contain the following top-level attributes: + +Attribute | Data type | Description +--- | --- | --- +`breadcrumbs` | `Breadcrumb` | A `Breadcrumb` object contains information the categories that comprise the breadcrumb trail for the specified category +`children` | `CategoryTree` | A `CategoryTree` object that contains information about a child category. You can specify up to 10 levels of child categories +`created_at`| String | Timestamp indicating when the category was created +`default_sort_by`| String | The attribute to use for sorting +`description`| String | An optional description of the category +`id` | Int | An ID that uniquely identifies the category +`level` | Int | Indicates the depth of the category within the tree +`name`| String | The display name of the category +`path_in_store`| String | Category path in the store +`path`| String | The path to the category, as a string of category IDs, separated by slashes (/). For example, `1/2/20` +`position`| Int | The position of the category relative to other categories at the same level in tree +`product_count`| Int | The number of products in the category +`products()` | `CategoryProducts` | The list of products assigned to the category +`updated_at`| String | Timestamp indicating when the category was updated +`url_key`| String | The url key assigned to the category +`url_path`| String | The url path assigned to the category + +### CategoryProducts object + +The `products` attribute can contain the following attributes: + +Attribute | Data type | Description +--- | --- | --- +`currentPage` | Int | Specifies which page of results to return. The default value is 1 +`pageSize` | Int | Specifies the maximum number of results to return at once. This attribute is optional. The default value is 20 +`sort` | `ProductSortInput` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) describes sort orders + +The `CategoryProducts` object contains the following attributes: + +Attribute | Data type | Description +--- | --- | --- +`items` | [ProductInterface] | An array of products that are assigned to the category. See [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html) for more information +`page_info` | `SearchResultPageInfo` | An object that includes the `page_info` and `currentPage` values specified in the query +`total_count` | Int | The number of products returned + +### Breadcrumb object + +A breadcrumb trail is a set of links that shows customers where they are in relation to other pages in the +store. + +Attribute | Data type | Description +--- | --- | --- +`category_id` | Int | An ID that uniquely identifies the category +`category_level` | Int | Indicates the depth of the category within the tree +`category_name` | String | The display name of the category +`category_url_key` | String | The url key assigned to the category + +### CategoryTree object + +This `CategoryTree` object contains information about the next level of subcategories of the category specified in the original query. + +Attribute | Data type | Description +--- | --- | --- +`children` | [CategoryTree] | An array containing the next level of subcategories diff --git a/guides/v2.3/graphql/queries/checkout-agreements.md b/guides/v2.3/graphql/queries/checkout-agreements.md index ee429b33842..b5b9eaf36e7 100644 --- a/guides/v2.3/graphql/queries/checkout-agreements.md +++ b/guides/v2.3/graphql/queries/checkout-agreements.md @@ -18,7 +18,7 @@ The following query returns enabled checkout agreements. **Request** -```text +```graphql { checkoutAgreements { agreement_id diff --git a/guides/v2.3/graphql/queries/cms-blocks.md b/guides/v2.3/graphql/queries/cms-blocks.md index 58b53064aba..eac5700af8d 100644 --- a/guides/v2.3/graphql/queries/cms-blocks.md +++ b/guides/v2.3/graphql/queries/cms-blocks.md @@ -17,7 +17,7 @@ The following query returns information about the `login-data` block: **Request** -```text +```graphql { cmsBlocks(identifiers: "login-data") { items { diff --git a/guides/v2.3/graphql/queries/cms-page.md b/guides/v2.3/graphql/queries/cms-page.md index e17c97113e6..5a7f5dc7e6b 100644 --- a/guides/v2.3/graphql/queries/cms-page.md +++ b/guides/v2.3/graphql/queries/cms-page.md @@ -19,7 +19,7 @@ The following query returns information about the "404 Not Found" CMS page: **Request** -```text +```graphql { cmsPage(identifier: 1) { url_key @@ -66,8 +66,9 @@ The `CmsPage` object can contain the following attributes: Attribute | Data type | Description --- | --- | --- -`content_heading` | String | The heading that displays at the top of the CMS page `content` | String | The content of the CMS page in raw HTML +`content_heading` | String | The heading that displays at the top of the CMS page +`identifier` | String | The identifier of the CMS page `meta_description` | String | A brief description of the page for search results listings `meta_keywords` | String | A set of keywords that search engines can use to index the page `meta_title` | String | A page title that is indexed by search engines and appears in search results listings diff --git a/guides/v2.3/graphql/queries/custom-attribute-metadata.md b/guides/v2.3/graphql/queries/custom-attribute-metadata.md index 581416d8438..bc6437d3dbe 100644 --- a/guides/v2.3/graphql/queries/custom-attribute-metadata.md +++ b/guides/v2.3/graphql/queries/custom-attribute-metadata.md @@ -124,8 +124,8 @@ The `customAttributeMetadata` query requires the following attributes as input. Attribute | Data Type | Description --- | --- | --- -`attribute_code` | String! | The unique identifier for an attribute code. This value should be in lowercase letters without spaces -`entity_type` | String! | The type of entity that defines the attribute +`attribute_code` | String | The unique identifier for an attribute code. This value should be in lowercase letters without spaces +`entity_type` | String | The type of entity that defines the attribute ## Output attributes diff --git a/guides/v2.3/graphql/queries/directory-countries.md b/guides/v2.3/graphql/queries/directory-countries.md index b0fe5e9596b..20bb18f8dfe 100644 --- a/guides/v2.3/graphql/queries/directory-countries.md +++ b/guides/v2.3/graphql/queries/directory-countries.md @@ -15,7 +15,7 @@ The following query returns all countries listed for the current instance of Mag **Request** -```text +```graphql query { countries { id diff --git a/guides/v2.3/graphql/queries/directory-country.md b/guides/v2.3/graphql/queries/directory-country.md index cc4a7d66c75..b43b55036a8 100644 --- a/guides/v2.3/graphql/queries/directory-country.md +++ b/guides/v2.3/graphql/queries/directory-country.md @@ -17,7 +17,7 @@ The following query returns information about Australia. **Request** -```text +```graphql query { country(id: "AU") { id diff --git a/guides/v2.3/graphql/queries/directory-currency.md b/guides/v2.3/graphql/queries/directory-currency.md index 01276015b6e..40f477bdf30 100644 --- a/guides/v2.3/graphql/queries/directory-currency.md +++ b/guides/v2.3/graphql/queries/directory-currency.md @@ -15,7 +15,7 @@ The following query returns the currency for the current instance of Magento: **Request** -```text +```graphql query { currency { base_currency_code diff --git a/guides/v2.3/graphql/queries/get-payflow-link-token.md b/guides/v2.3/graphql/queries/get-payflow-link-token.md index 38132494e63..d1a69bb4933 100644 --- a/guides/v2.3/graphql/queries/get-payflow-link-token.md +++ b/guides/v2.3/graphql/queries/get-payflow-link-token.md @@ -17,7 +17,7 @@ The following example requests a token in a Payflow Link transaction. **Request** -```text +```graphql { getPayflowLinkToken(input: {cart_id: "123"}) { secure_token diff --git a/guides/v2.3/graphql/queries/giftcard-account.md b/guides/v2.3/graphql/queries/giftcard-account.md index cfcc144bd6b..44d9368da2c 100644 --- a/guides/v2.3/graphql/queries/giftcard-account.md +++ b/guides/v2.3/graphql/queries/giftcard-account.md @@ -18,7 +18,7 @@ The following example returns information about the `01PNC9L76H4H` gift card cod **Request** -``` text +```graphql query { giftCardAccount(input: {gift_card_code: "01PNC9L76H4H"}){ code diff --git a/guides/v2.3/graphql/queries/products.md b/guides/v2.3/graphql/queries/products.md index 9f22d448aa6..33e431d731c 100644 --- a/guides/v2.3/graphql/queries/products.md +++ b/guides/v2.3/graphql/queries/products.md @@ -40,9 +40,9 @@ The `search` element is optional, but it can be used with or without filters. Ea ### filter attribute -'The `ProductFilterInput` object defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for. The following example filter searches for products that has a `sku` that contains the string `24-MB` with a `price` that's less than `50`. +The `ProductFilterInput` object defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for. The following example filter searches for products that has a `sku` that contains the string `24-MB` with a `price` that's less than `50`. -``` text +```graphql filter: { sku: { like: "24-MB%" @@ -202,10 +202,8 @@ When a product requires a filter attribute that is not a field on its output sch This example adds `field_to_sort` and `other_field_to_sort` attributes to the `additionalAttributes` array defined in the `ProductEntityAttributesForAst` class. The array already contains the `min_price`, `max_price`, and `category_ids` attributes. - ## Sample queries - ### Full text search The following search returns items that contain the word `yoga` or `pants`. The Catalog Search index contains search terms taken from the product `name`, `description`, `short_description` and related attributes. @@ -475,7 +473,7 @@ The query returns 14 items. The following query shows how to get related products, Up-sells and Cross-sells for the particular product: -```text +```graphql { products(filter: { sku: { eq: "24-WB06" } }) { items { @@ -572,7 +570,6 @@ The following query shows how to get related products, Up-sells and Cross-sells } ``` - ### Layered navigation The following query returns layered navigation for products that have a `sku` containing the string `24-WB`. @@ -683,7 +680,7 @@ query { ### Include website information with `products` query results {#inclWebsiteInfoExample} -The [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface) can include information about the `Website` object. +The [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html) can include information about the `Website` object. **Request** diff --git a/guides/v2.3/graphql/queries/wishlist.md b/guides/v2.3/graphql/queries/wishlist.md index 3187a862f88..f6e27e5c3f2 100644 --- a/guides/v2.3/graphql/queries/wishlist.md +++ b/guides/v2.3/graphql/queries/wishlist.md @@ -92,5 +92,5 @@ Attribute | Data type | Description `added_at` | String | The time when the customer added the item to the wish list `description` | String | The customer's comment about this item `id` | Int | The wish list item ID -`product` | [ProductInterface]({{ page.baseurl }}/graphql/queries/products.html#ProductInterface) | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes +`product` | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html) | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes `qty` | Float | The quantity of this wish list item From 83bacbbb6916c976b5c39a5c98b4aea325e3d882 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Tue, 1 Oct 2019 14:11:36 -0500 Subject: [PATCH 4/5] cosmetic changes, missing attributes --- .../mutations/add-configurable-products.md | 29 ++++++++++++------- .../v2.3/graphql/mutations/apply-giftcard.md | 2 +- .../graphql/mutations/apply-store-credit.md | 2 +- .../mutations/change-customer-password.md | 4 +-- .../graphql/mutations/create-empty-cart.md | 2 +- .../mutations/delete-customer-address.md | 6 +++- .../mutations/generate-customer-token.md | 10 ++++++- guides/v2.3/graphql/mutations/place-order.md | 10 +++++-- .../mutations/redeem-giftcard-balance.md | 2 +- .../v2.3/graphql/mutations/remove-coupon.md | 8 ++--- .../v2.3/graphql/mutations/remove-giftcard.md | 8 ++--- guides/v2.3/graphql/mutations/remove-item.md | 2 +- .../graphql/mutations/remove-store-credit.md | 2 +- .../graphql/mutations/set-billing-address.md | 2 +- .../v2.3/graphql/mutations/set-guest-email.md | 2 +- .../graphql/mutations/set-payment-method.md | 20 ++++++++----- .../mutations/set-payment-place-order.md | 4 ++- .../graphql/mutations/set-shipping-address.md | 2 +- .../graphql/mutations/set-shipping-method.md | 2 +- .../graphql/mutations/update-cart-items.md | 2 +- guides/v2.3/graphql/queries/store-config.md | 4 +-- 21 files changed, 76 insertions(+), 49 deletions(-) diff --git a/guides/v2.3/graphql/mutations/add-configurable-products.md b/guides/v2.3/graphql/mutations/add-configurable-products.md index 080c960db1e..034b2b6cb2f 100644 --- a/guides/v2.3/graphql/mutations/add-configurable-products.md +++ b/guides/v2.3/graphql/mutations/add-configurable-products.md @@ -22,7 +22,7 @@ mutation { cart_id: "4JQaNVJokOpFxrykGVvYrjhiNv9qt31C" cart_items: [ { - variant_sku: "MH02" + parent_sku: "MH02" data: { quantity: 2 sku: "MH02-XS-Black" @@ -59,12 +59,20 @@ mutation { "cart": { "items": [ { - "id": "26", + "id": "5", "quantity": 2, "product": { - "name": "Teton Pullover Hoodie-XS-Black", - "sku": "MH02-XS-Black" - } + "name": "Teton Pullover Hoodie", + "sku": "MH02" + }, + "configurable_options": [ + { + "option_label": "Color" + }, + { + "option_label": "Size" + } + ] } ] } @@ -81,8 +89,8 @@ The `AddConfigurableProductsToCartInput` object contains the following attribute Attribute | Type | Description --- | --- | --- -`cart_items` | [[ConfigurableProductCartItemInput]](#configProdCartItemInput) | An array of configurable items to add to the cart `cart_id` | String | The unique ID that identifies the customer's cart +`cart_items` | [[ConfigurableProductCartItemInput]](#configProdCartItemInput) | An array of configurable items to add to the cart ### ConfigurableProductCartItemInput object {#configProdCartItemInput} @@ -91,8 +99,9 @@ The `ConfigurableProductCartItemInput` object contains the following attributes: Attribute | Type | Description --- | --- | --- `customizable_options` | [CustomizableOptionInput](#customOptionInput) | An object that contains the ID and value of the product -`data` | [CartItemInput](#cartItemInput) | An object that contains the quantity and SKU of the configurable product -`variant_sku` | String | The SKU of the simple product +`data` | [CartItemInput!](#cartItemInput) | An object that contains the quantity and SKU of the configurable product +`parent_sku` | String | The SKU of the simple product's parent configurable product +`variant_sku` | String | Deprecated. Use `CartItemInput.sku` instead. The SKU of the simple product ### CustomizableOptionInput object {#customOptionInput} @@ -109,8 +118,8 @@ The `CartItemInput` object contains the following attributes: Attribute | Type | Description --- | --- | --- -`quantity` | Float | The number of configurable items to add to the cart -`sku` | String | The SKU of the configurable product +`quantity` | Float! | The number of items to add to the cart +`sku` | String! | The SKU of the simple product ## Output attributes diff --git a/guides/v2.3/graphql/mutations/apply-giftcard.md b/guides/v2.3/graphql/mutations/apply-giftcard.md index 872de57ca98..c3879787dd4 100644 --- a/guides/v2.3/graphql/mutations/apply-giftcard.md +++ b/guides/v2.3/graphql/mutations/apply-giftcard.md @@ -18,7 +18,7 @@ The following example adds a gift card with the code `0330CEIVTLB4` to the cart. **Request** -``` text +```graphql mutation { applyGiftCardToCart( input: { diff --git a/guides/v2.3/graphql/mutations/apply-store-credit.md b/guides/v2.3/graphql/mutations/apply-store-credit.md index 2220e570197..ba0a84513a2 100644 --- a/guides/v2.3/graphql/mutations/apply-store-credit.md +++ b/guides/v2.3/graphql/mutations/apply-store-credit.md @@ -23,7 +23,7 @@ In the following example, the customer starts with $10 of store credit. The subt **Request** -```text +```graphql mutation { applyStoreCreditToCart( input: { diff --git a/guides/v2.3/graphql/mutations/change-customer-password.md b/guides/v2.3/graphql/mutations/change-customer-password.md index d61f3eac03e..480fa90c293 100644 --- a/guides/v2.3/graphql/mutations/change-customer-password.md +++ b/guides/v2.3/graphql/mutations/change-customer-password.md @@ -9,7 +9,7 @@ To return or modify information about a customer, Magento recommends you use cus ## Syntax -`mutation: {changeCustomerPassword(currentPassword: String!newPassword: String!) {Customer}}` +`mutation: {changeCustomerPassword(currentPassword: String! newPassword: String!) {Customer}}` ## Example usage @@ -44,7 +44,7 @@ mutation { ## Input attributes -The `changeCustomerPassword` object requires the following inputs: +The `changeCustomerPassword` mutation requires the following inputs: Attribute | Data Type | Description --- | --- | --- diff --git a/guides/v2.3/graphql/mutations/create-empty-cart.md b/guides/v2.3/graphql/mutations/create-empty-cart.md index d748b4644df..ab52c5b284a 100644 --- a/guides/v2.3/graphql/mutations/create-empty-cart.md +++ b/guides/v2.3/graphql/mutations/create-empty-cart.md @@ -19,7 +19,7 @@ If you are creating a cart for a logged in customer, you must include the custom **Request** -```text +```graphql mutation { createEmptyCart } diff --git a/guides/v2.3/graphql/mutations/delete-customer-address.md b/guides/v2.3/graphql/mutations/delete-customer-address.md index dc74d630904..1e9a76cc51b 100644 --- a/guides/v2.3/graphql/mutations/delete-customer-address.md +++ b/guides/v2.3/graphql/mutations/delete-customer-address.md @@ -35,12 +35,16 @@ mutation { ## Input attributes -The `deleteCustomerAddress` object requires the following input: +The `deleteCustomerAddress` mutation requires the following input: Attribute | Data Type | Description --- | --- | --- `id` | Int! | The ID assigned to the address object +## Output attributes + +The `deleteCustomerAddress` mutation returns a Boolean value that indicates whether the operation was successful. + ## Related topics * [customer query]({{page.baseurl}}/graphql/queries/customer.html) diff --git a/guides/v2.3/graphql/mutations/generate-customer-token.md b/guides/v2.3/graphql/mutations/generate-customer-token.md index 5ec8d415ef9..a0e8309f514 100644 --- a/guides/v2.3/graphql/mutations/generate-customer-token.md +++ b/guides/v2.3/graphql/mutations/generate-customer-token.md @@ -42,13 +42,21 @@ mutation { ## Input attributes -The `generateCustomerToken` object requires the following inputs: +The `generateCustomerToken` mutation requires the following inputs: Attribute | Data Type | Description --- | --- | --- `email` | String | The customer's email address `password` | String | The customer's password +## Output attributes + +The `generateCustomerToken` mutation returns a valid token for the customer. + +Attribute | Data Type | Description +--- | --- | --- +`token` | String | The customer token + ## Related topics * [customer query]({{page.baseurl}}/graphql/queries/customer.html) diff --git a/guides/v2.3/graphql/mutations/place-order.md b/guides/v2.3/graphql/mutations/place-order.md index 8cdccd1e597..ad5741abf6c 100644 --- a/guides/v2.3/graphql/mutations/place-order.md +++ b/guides/v2.3/graphql/mutations/place-order.md @@ -63,8 +63,14 @@ Attribute | Data Type | Description ## Output attributes -The `placeOrderOutput` object contains the `order` object, which contains the following attribute: +The `placeOrderOutput` object returns an `order` object. Attribute | Data Type | Description --- | --- | --- -`order_id` | String! | The unique ID that identifies the order +`order` | Order! | The unique ID that identifies the order + +### Order object + +Attribute | Data Type | Description +--- | --- | --- +`order_id` | String | The unique ID that identifies the order diff --git a/guides/v2.3/graphql/mutations/redeem-giftcard-balance.md b/guides/v2.3/graphql/mutations/redeem-giftcard-balance.md index 15529e95b29..057d70a8284 100644 --- a/guides/v2.3/graphql/mutations/redeem-giftcard-balance.md +++ b/guides/v2.3/graphql/mutations/redeem-giftcard-balance.md @@ -19,7 +19,7 @@ The following example redeems the gift card with code `“056MHP57TJ5C”`. **Request** -``` text +```graphql mutation { redeemGiftCardBalanceAsStoreCredit( input : { gift_card_code: “056MHP57TJ5C”} diff --git a/guides/v2.3/graphql/mutations/remove-coupon.md b/guides/v2.3/graphql/mutations/remove-coupon.md index 49370bd24bd..3bf26f8a962 100644 --- a/guides/v2.3/graphql/mutations/remove-coupon.md +++ b/guides/v2.3/graphql/mutations/remove-coupon.md @@ -80,11 +80,7 @@ mutation { ## Input attributes -The `removeCouponFromCart` mutation requires the `cart_id` attribute. - -### removeCouponFromCart object {#removeCouponFromCart} - -The `removeCouponFromCart` object must contain the following attributes: +The `removeCouponFromCart` mutation must contain the following attribute: Attribute | Data Type | Description --- | --- | --- @@ -92,7 +88,7 @@ Attribute | Data Type | Description ## Output attributes -The `removeCouponFromCart` object contains the `Cart` object. +The `removeCouponFromCart` mutation returns the `Cart` object. Attribute | Data Type | Description --- | --- | --- diff --git a/guides/v2.3/graphql/mutations/remove-giftcard.md b/guides/v2.3/graphql/mutations/remove-giftcard.md index b2e31de881d..42d0816be83 100644 --- a/guides/v2.3/graphql/mutations/remove-giftcard.md +++ b/guides/v2.3/graphql/mutations/remove-giftcard.md @@ -49,11 +49,7 @@ mutation { ## Input attributes -The `removeGiftCardFromCart` mutation requires the `cart_id` attribute. - -### removeGiftCardFromCart object {#removeGiftCardFromCart} - -The `removeGiftCardFromCart` object must contain the following attributes: +The `removeGiftCardFromCartInput` object must contain the following attributes: Attribute | Data Type | Description --- | --- | --- @@ -62,7 +58,7 @@ Attribute | Data Type | Description ## Output attributes -The `removeGiftCardFromCart` object contains the `Cart` object. +The `removeGiftCardFromCartOutput` object contains the `Cart` object. Attribute | Data Type | Description --- | --- | --- diff --git a/guides/v2.3/graphql/mutations/remove-item.md b/guides/v2.3/graphql/mutations/remove-item.md index 7b7e84e38e4..cd565dcc523 100644 --- a/guides/v2.3/graphql/mutations/remove-item.md +++ b/guides/v2.3/graphql/mutations/remove-item.md @@ -17,7 +17,7 @@ The following example removes cart item 14 from the cart. **Request** -```text +```graphql mutation { removeItemFromCart( input: { diff --git a/guides/v2.3/graphql/mutations/remove-store-credit.md b/guides/v2.3/graphql/mutations/remove-store-credit.md index d0c289db1bc..ce938dff89c 100644 --- a/guides/v2.3/graphql/mutations/remove-store-credit.md +++ b/guides/v2.3/graphql/mutations/remove-store-credit.md @@ -16,7 +16,7 @@ Store credit must be enabled on the store to run this mutation. **Request** -```text +```graphql mutation { removeStoreCreditFromCart( input: { diff --git a/guides/v2.3/graphql/mutations/set-billing-address.md b/guides/v2.3/graphql/mutations/set-billing-address.md index 1ff1119fffc..2cfa2e598c5 100644 --- a/guides/v2.3/graphql/mutations/set-billing-address.md +++ b/guides/v2.3/graphql/mutations/set-billing-address.md @@ -17,7 +17,7 @@ The following example creates a new billing address for a specific cart. **Request** -``` text +```graphql mutation { setBillingAddressOnCart( input: { diff --git a/guides/v2.3/graphql/mutations/set-guest-email.md b/guides/v2.3/graphql/mutations/set-guest-email.md index d5920a3d38c..210841339b0 100644 --- a/guides/v2.3/graphql/mutations/set-guest-email.md +++ b/guides/v2.3/graphql/mutations/set-guest-email.md @@ -17,7 +17,7 @@ A logged-in customer specifies an email address when they create an account. The **Request** -``` text +```graphql mutation { setGuestEmailOnCart( input: { diff --git a/guides/v2.3/graphql/mutations/set-payment-method.md b/guides/v2.3/graphql/mutations/set-payment-method.md index ef51bbb94e5..2c2b149accc 100644 --- a/guides/v2.3/graphql/mutations/set-payment-method.md +++ b/guides/v2.3/graphql/mutations/set-payment-method.md @@ -5,7 +5,7 @@ redirect from: - /guides/v2.3/graphql/reference/quote-payment-method.html --- -The `setPaymentMethodOnCart` mutation defines which payment method to apply to the cart. Magento GraphQL supports the following payment methods: +The `setPaymentMethodOnCart` mutation defines which payment method to apply to the cart. Magento GraphQL supports the following offline payment methods: Title | Code --- | --- @@ -14,13 +14,19 @@ Cash on Delivery | `cashondelivery` Check / Money order | `checkmo` Credit Card (Authorize.Net) | `authorizenet_acceptjs` No Payment Information Required | `free` -[PayPal Express Checkout]({{ page.baseurl}}/graphql/payment-methods/paypal-express-checkout.html) | `paypal_express` -[PayPal Express Checkout Payflow Edition]({{ page.baseurl}}/graphql/payment-methods/paypal-express-checkout.html) | `payflow_express` -PayPal Payflow Pro | `payflowpro` -PayPal Payflow Link | `payflow_link` Purchase Order | `purchaseorder` -Apply the `setPaymentMethodOnCart` mutation after setting the shipping address, shipping method, and after applying any discounts to the cart. +Supported online payment methods include: + +- [Authorize.Net]({{page.baseurl}}/payment-methods/authorize-net.html) +- [Braintree]({{page.baseurl}}/payment-methods/braintree.html) +- [Braintree Vault]({{page.baseurl}}/payment-methods/braintree-vault.html) +- [PayPal Express Checkout]({{page.baseurl}}/payment-methods/paypal-express-checkout.html) +- [PayPal Payflow Link]({{page.baseurl}}/payment-methods/payflow-link.html) +- [PayPal Payflow Pro]({{page.baseurl}}/payment-methods/payflow-pro.html) +- [PayPal Payments Advanced]({{page.baseurl}}/payment-methods/payments-advanced.html) +- [PayPal Website Payments Pro Hosted Solution]({{page.baseurl}}/payment-methods/hosted-pro.html) +- [Express Checkout for other PayPal solutions]({{page.baseurl}}/payment-methods/payflow-express.html) ## Syntax @@ -99,7 +105,7 @@ The `SetPaymentMethodOnCartOutput` object contains the `Cart` object. Attribute | Data Type | Description --- | --- | --- -`cart` |[ Cart!](#CartObject) | Describes the contents of the specified shopping cart +`cart` |[Cart!](#CartObject) | Describes the contents of the specified shopping cart ### Cart object {#CartObject} diff --git a/guides/v2.3/graphql/mutations/set-payment-place-order.md b/guides/v2.3/graphql/mutations/set-payment-place-order.md index bb6be7a8f13..26ac1d75441 100644 --- a/guides/v2.3/graphql/mutations/set-payment-place-order.md +++ b/guides/v2.3/graphql/mutations/set-payment-place-order.md @@ -7,6 +7,8 @@ redirect from: - /guides/v2.3/graphql/reference/quote-set-payment-place-order.html --- +{:.bs-callout-note} The `setPaymentMethodAndPlaceOrder` mutation will be deprecated in the next patch release. Use the `setPaymentMethodOnCart` and `placeOrder` mutations instead. You can run the two methods in the same call if your use case allows it. + The `setPaymentMethodAndPlaceOrder` mutation sets the cart payment method and converts the cart into an order. The mutation returns the resulting order ID. You cannot manage orders with GraphQL, because orders are part of the backend. You can use REST or SOAP calls to manage orders to their completion. @@ -28,7 +30,7 @@ Perform the following actions before using the `setPaymentMethodAndPlaceOrder` m **Request** -``` text +```graphql mutation { setPaymentMethodAndPlaceOrder( input: { diff --git a/guides/v2.3/graphql/mutations/set-shipping-address.md b/guides/v2.3/graphql/mutations/set-shipping-address.md index 031dd3bba32..7462fd99e2c 100644 --- a/guides/v2.3/graphql/mutations/set-shipping-address.md +++ b/guides/v2.3/graphql/mutations/set-shipping-address.md @@ -18,7 +18,7 @@ The `setShippingAddressesOnCart` mutation sets one or more shipping addresses on **Request** -``` text +```graphql mutation { setShippingAddressesOnCart( input: { diff --git a/guides/v2.3/graphql/mutations/set-shipping-method.md b/guides/v2.3/graphql/mutations/set-shipping-method.md index 843c18fe99f..1d7a0cd5a99 100644 --- a/guides/v2.3/graphql/mutations/set-shipping-method.md +++ b/guides/v2.3/graphql/mutations/set-shipping-method.md @@ -27,7 +27,7 @@ The following example sets the shipping method to Best Way. **Request** -``` text +```graphql mutation { setShippingMethodsOnCart( input: { diff --git a/guides/v2.3/graphql/mutations/update-cart-items.md b/guides/v2.3/graphql/mutations/update-cart-items.md index ab26c1dde1f..26d405a6e7d 100644 --- a/guides/v2.3/graphql/mutations/update-cart-items.md +++ b/guides/v2.3/graphql/mutations/update-cart-items.md @@ -20,7 +20,7 @@ The following example changes the quantity of cart item `13`. The new quantity i **Request** -```text +```graphql mutation { updateCartItems( input: { diff --git a/guides/v2.3/graphql/queries/store-config.md b/guides/v2.3/graphql/queries/store-config.md index e84442095ad..6bc5e68d720 100644 --- a/guides/v2.3/graphql/queries/store-config.md +++ b/guides/v2.3/graphql/queries/store-config.md @@ -215,8 +215,8 @@ Attribute | Data Type | Description `default_title` | String | The title that appears at the title bar of each page when viewed in a browser `demonotice` | Int | Controls the display of the demo store notice at the top of the page. Options: `0` (No) or `1` (Yes) `head_includes` | String | Contains scripts that must be included in the HTML before the closing `` tag -`header_logo_src` | String | The path to the logo that appears in the header `head_shortcut_icon` | String | Uploads the small graphic image that appears in the address bar and tab of the browser +`header_logo_src` | String | The path to the logo that appears in the header `logo_alt` | String | The Alt text that is associated with the logo `logo_height` | Int | The height of your logo image in pixels `logo_width` | Int | The width of your logo image in pixels @@ -246,7 +246,7 @@ Attribute | Data Type | Description | Example `catalog_default_sort_by` | String | The default sort order of the search results list | `position` `category_url_suffix` | String | The suffix applied to category pages, such as `.htm` or `.html` | `.html` `grid_per_page` | Integer | The default number of products per page in Grid View | `9` -`grid_per_page_values` | A list of numbers that define how many products can be displayed in List View | `9,15,30` +`grid_per_page_values` | String | A list of numbers that define how many products can be displayed in List View | `9,15,30` `list_mode` | String | The format of the search results list | `grid-list` `list_per_page` | Integer | The default number of products per page in List View | `10` `list_per_page_values` | String | A list of numbers that define how many products can be displayed in List View | `5,10,15,20,25` From 30d2894ec3e20aa8acc4351b36955b0cdfb8bac5 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Tue, 1 Oct 2019 15:41:34 -0500 Subject: [PATCH 5/5] fix broken links --- .../graphql/mutations/set-payment-method.md | 18 +++++++++--------- .../product-interface-implementations.md | 8 ++++---- .../v2.3/graphql/product/product-interface.md | 4 ++-- guides/v2.3/graphql/queries/products.md | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/guides/v2.3/graphql/mutations/set-payment-method.md b/guides/v2.3/graphql/mutations/set-payment-method.md index 2c2b149accc..c2dce5ded77 100644 --- a/guides/v2.3/graphql/mutations/set-payment-method.md +++ b/guides/v2.3/graphql/mutations/set-payment-method.md @@ -18,15 +18,15 @@ Purchase Order | `purchaseorder` Supported online payment methods include: -- [Authorize.Net]({{page.baseurl}}/payment-methods/authorize-net.html) -- [Braintree]({{page.baseurl}}/payment-methods/braintree.html) -- [Braintree Vault]({{page.baseurl}}/payment-methods/braintree-vault.html) -- [PayPal Express Checkout]({{page.baseurl}}/payment-methods/paypal-express-checkout.html) -- [PayPal Payflow Link]({{page.baseurl}}/payment-methods/payflow-link.html) -- [PayPal Payflow Pro]({{page.baseurl}}/payment-methods/payflow-pro.html) -- [PayPal Payments Advanced]({{page.baseurl}}/payment-methods/payments-advanced.html) -- [PayPal Website Payments Pro Hosted Solution]({{page.baseurl}}/payment-methods/hosted-pro.html) -- [Express Checkout for other PayPal solutions]({{page.baseurl}}/payment-methods/payflow-express.html) +- [Authorize.Net]({{page.baseurl}}/graphql/payment-methods/authorize-net.html) +- [Braintree]({{page.baseurl}}/graphql/payment-methods/braintree.html) +- [Braintree Vault]({{page.baseurl}}/graphql/payment-methods/braintree-vault.html) +- [PayPal Express Checkout]({{page.baseurl}}/graphql/payment-methods/paypal-express-checkout.html) +- [PayPal Payflow Link]({{page.baseurl}}/graphql/payment-methods/payflow-link.html) +- [PayPal Payflow Pro]({{page.baseurl}}/graphql/payment-methods/payflow-pro.html) +- [PayPal Payments Advanced]({{page.baseurl}}/graphql/payment-methods/payments-advanced.html) +- [PayPal Website Payments Pro Hosted Solution]({{page.baseurl}}/graphql/payment-methods/hosted-pro.html) +- [Express Checkout for other PayPal solutions]({{page.baseurl}}/graphql/payment-methods/payflow-express.html) ## Syntax diff --git a/guides/v2.3/graphql/product/product-interface-implementations.md b/guides/v2.3/graphql/product/product-interface-implementations.md index 47d7b912d18..8ceda358eb1 100644 --- a/guides/v2.3/graphql/product/product-interface-implementations.md +++ b/guides/v2.3/graphql/product/product-interface-implementations.md @@ -9,11 +9,11 @@ Magento provides multiple product types, and most of these product types have sp Product type | Implements | Has product-specific attributes? --- | --- | --- -* [BundleProduct]({{ page.baseurl }}/graphql/reference/bundle-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes -* [ConfigurableProduct]({{ page.baseurl }}/graphql/product/configurable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes +* [BundleProduct]({{ page.baseurl }}/graphql/reference/bundle-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes +* [ConfigurableProduct]({{ page.baseurl }}/graphql/product/configurable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes * [DownloadableProduct]({{ page.baseurl }}/graphql/product/downloadable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes -* [GroupedProduct]({{ page.baseurl }}/graphql/product/grouped-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes -* SimpleProduct | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/queries/products.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | No +* [GroupedProduct]({{ page.baseurl }}/graphql/product/grouped-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | Yes +* SimpleProduct | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | No * VirtualProduct | [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/product/customizable-option-interface.html) | No ## Query for product-specific attributes diff --git a/guides/v2.3/graphql/product/product-interface.md b/guides/v2.3/graphql/product/product-interface.md index f31f6e274d8..c9a8e2cd3d2 100644 --- a/guides/v2.3/graphql/product/product-interface.md +++ b/guides/v2.3/graphql/product/product-interface.md @@ -62,8 +62,8 @@ Attribute | Data type | Description `upsell_products` | [ProductInterface] | An array of up-sell products `url_key` | String | The part of the URL that identifies the product. This attribute is defined in the `CatalogUrlRewriteGraphQl` module `url_path` | String | Deprecated. Use `canonical_url` instead -`url_rewrites` | [[UrlRewrite]](#urlRewriteObject) | A list of URL rewrites. See [UrlRewrite object](#urlRewriteObject) for more information and an [example query](#urlRewriteExample) -`websites` | [Website] | An array of websites in which the product is available. See [Website object](#websiteObject) for more information and an [example query](#inclWebsiteInfoExample) +`url_rewrites` | [[UrlRewrite]](#urlRewriteObject) | A list of URL rewrites +`websites` | [[Website]](#websiteObject) | An array of websites in which the product is available ### ProductPrices object {#ProductPrices} diff --git a/guides/v2.3/graphql/queries/products.md b/guides/v2.3/graphql/queries/products.md index 33e431d731c..c9719353495 100644 --- a/guides/v2.3/graphql/queries/products.md +++ b/guides/v2.3/graphql/queries/products.md @@ -38,7 +38,7 @@ The `search` element causes Magento to perform a full text search on the specifi The `search` element is optional, but it can be used with or without filters. Each query must contain a `search` or `filter` element. -### filter attribute +### filter attribute {#ProductFilterInput} The `ProductFilterInput` object defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for. The following example filter searches for products that has a `sku` that contains the string `24-MB` with a `price` that's less than `50`.