From 4ab36345856b0443b63854d58d3c760670715ea9 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Tue, 29 Oct 2024 12:09:12 -0400 Subject: [PATCH 1/3] fix: "Product" interface applied to all sub Product interfaces for more optimal schema shape --- composer.json | 3 +- composer.lock | 74 ++++++++++--------- .../interface/class-downloadable-product.php | 6 +- .../interface/class-inventoried-product.php | 2 +- .../type/interface/class-product-union.php | 2 +- .../class-product-with-attributes.php | 2 +- .../class-product-with-dimensions.php | 2 +- .../interface/class-product-with-pricing.php | 2 +- .../class-product-with-variations.php | 2 +- includes/type/interface/class-product.php | 4 + 10 files changed, 51 insertions(+), 48 deletions(-) diff --git a/composer.json b/composer.json index 5936d4d1..3aa7124a 100644 --- a/composer.json +++ b/composer.json @@ -40,8 +40,7 @@ "allow-plugins": { "johnpbloch/wordpress-core-installer": true, "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true, - "composer/installers": true + "phpstan/extension-installer": true } }, "autoload": { diff --git a/composer.lock b/composer.lock index 69228781..1ec27587 100644 --- a/composer.lock +++ b/composer.lock @@ -185,16 +185,16 @@ }, { "name": "axepress/wp-graphql-stubs", - "version": "v1.27.1", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/AxeWP/wp-graphql-stubs.git", - "reference": "84ef51264b142d92c0ac9aa39edf2cce5f0ac3af" + "reference": "79bc096361b1bf65a6b367a382fa90407d8952ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AxeWP/wp-graphql-stubs/zipball/84ef51264b142d92c0ac9aa39edf2cce5f0ac3af", - "reference": "84ef51264b142d92c0ac9aa39edf2cce5f0ac3af", + "url": "https://api.github.com/repos/AxeWP/wp-graphql-stubs/zipball/79bc096361b1bf65a6b367a382fa90407d8952ba", + "reference": "79bc096361b1bf65a6b367a382fa90407d8952ba", "shasum": "" }, "require": { @@ -225,7 +225,7 @@ ], "support": { "issues": "https://github.com/AxeWP/wp-graphql-stubs/issues", - "source": "https://github.com/AxeWP/wp-graphql-stubs/tree/v1.27.1" + "source": "https://github.com/AxeWP/wp-graphql-stubs/tree/v1.29.0" }, "funding": [ { @@ -233,7 +233,7 @@ "type": "github" } ], - "time": "2024-07-04T12:37:29+00:00" + "time": "2024-09-20T01:43:19+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -359,16 +359,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.6.0", + "version": "v6.6.2", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2" + "reference": "f50fd7ed45894d036e4fef9ab7e5bbbaff6a30cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/86e8753e89d59849276dcdd91b9a7dd78bb4abe2", - "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/f50fd7ed45894d036e4fef9ab7e5bbbaff6a30cc", + "reference": "f50fd7ed45894d036e4fef9ab7e5bbbaff6a30cc", "shasum": "" }, "require-dev": { @@ -401,9 +401,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.6.0" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.6.2" }, - "time": "2024-07-17T08:50:38+00:00" + "time": "2024-09-30T07:10:48+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -777,22 +777,22 @@ }, { "name": "phpstan/extension-installer", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203" + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f6b87faf9fc7978eab2f7919a8760bc9f58f9203", - "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", "shasum": "" }, "require": { "composer-plugin-api": "^2.0", "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.0" + "phpstan/phpstan": "^1.9.0 || ^2.0" }, "require-dev": { "composer/composer": "^2.0", @@ -813,24 +813,28 @@ "MIT" ], "description": "Composer plugin for automatic installation of PHPStan extensions", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.4.1" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" }, - "time": "2024-06-10T08:20:49+00:00" + "time": "2024-09-04T20:21:43+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.1", + "version": "1.33.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", - "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", "shasum": "" }, "require": { @@ -862,22 +866,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" }, - "time": "2024-05-31T08:52:43+00:00" + "time": "2024-10-13T11:25:22+00:00" }, { "name": "phpstan/phpstan", - "version": "1.11.8", + "version": "1.12.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec" + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", - "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", "shasum": "" }, "require": { @@ -922,7 +926,7 @@ "type": "github" } ], - "time": "2024-07-24T07:01:22+00:00" + "time": "2024-10-18T11:12:07+00:00" }, { "name": "sirbrillig/phpcs-variable-analysis", @@ -1049,16 +1053,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { @@ -1125,7 +1129,7 @@ "type": "open_collective" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-09-18T10:38:58+00:00" }, { "name": "symfony/polyfill-php73", diff --git a/includes/type/interface/class-downloadable-product.php b/includes/type/interface/class-downloadable-product.php index effcc706..cf57c2dd 100644 --- a/includes/type/interface/class-downloadable-product.php +++ b/includes/type/interface/class-downloadable-product.php @@ -25,7 +25,7 @@ public static function register_interface(): void { 'DownloadableProduct', [ 'description' => __( 'A downloadable product.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node' ], + 'interfaces' => [ 'Node', 'Product' ], 'fields' => self::get_fields(), 'resolveType' => [ Core::class, 'resolve_product_type' ], ] @@ -47,10 +47,6 @@ public static function get_fields() { 'type' => [ 'non_null' => 'Int' ], 'description' => __( 'Product or variation ID', 'wp-graphql-woocommerce' ), ], - 'virtual' => [ - 'type' => 'Boolean', - 'description' => __( 'Is product virtual?', 'wp-graphql-woocommerce' ), - ], 'downloadExpiry' => [ 'type' => 'Int', 'description' => __( 'Download expiry', 'wp-graphql-woocommerce' ), diff --git a/includes/type/interface/class-inventoried-product.php b/includes/type/interface/class-inventoried-product.php index 44fcfa8c..e8a11f8e 100644 --- a/includes/type/interface/class-inventoried-product.php +++ b/includes/type/interface/class-inventoried-product.php @@ -25,7 +25,7 @@ public static function register_interface(): void { 'InventoriedProduct', [ 'description' => __( 'A product with stock information.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node' ], + 'interfaces' => [ 'Node', 'Product' ], 'fields' => self::get_fields(), 'resolveType' => [ Core::class, 'resolve_product_type' ], ] diff --git a/includes/type/interface/class-product-union.php b/includes/type/interface/class-product-union.php index 6477af97..100b23a0 100644 --- a/includes/type/interface/class-product-union.php +++ b/includes/type/interface/class-product-union.php @@ -26,7 +26,7 @@ public static function register_interface(): void { 'ProductUnion', [ 'description' => __( 'Union between the product and product variation types', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node' ], + 'interfaces' => [ 'Node', 'Product' ], 'fields' => self::get_fields(), 'resolveType' => [ Core::class, 'resolve_product_type' ], ] diff --git a/includes/type/interface/class-product-with-attributes.php b/includes/type/interface/class-product-with-attributes.php index 3317cbbd..cb8356e9 100644 --- a/includes/type/interface/class-product-with-attributes.php +++ b/includes/type/interface/class-product-with-attributes.php @@ -28,7 +28,7 @@ public static function register_interface(): void { 'ProductWithAttributes', [ 'description' => __( 'Products with default attributes.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node' ], + 'interfaces' => [ 'Node', 'Product' ], 'fields' => self::get_fields(), 'connections' => self::get_connections(), 'resolveType' => [ Core::class, 'resolve_product_type' ], diff --git a/includes/type/interface/class-product-with-dimensions.php b/includes/type/interface/class-product-with-dimensions.php index 3a125df6..65d4717c 100644 --- a/includes/type/interface/class-product-with-dimensions.php +++ b/includes/type/interface/class-product-with-dimensions.php @@ -25,7 +25,7 @@ public static function register_interface(): void { 'ProductWithDimensions', [ 'description' => __( 'A physical product.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node' ], + 'interfaces' => [ 'Node', 'Product' ], 'fields' => self::get_fields(), 'resolveType' => [ Core::class, 'resolve_product_type' ], ] diff --git a/includes/type/interface/class-product-with-pricing.php b/includes/type/interface/class-product-with-pricing.php index 0e1a4753..ae9e586b 100644 --- a/includes/type/interface/class-product-with-pricing.php +++ b/includes/type/interface/class-product-with-pricing.php @@ -25,7 +25,7 @@ public static function register_interface(): void { 'ProductWithPricing', [ 'description' => __( 'Products with pricing.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node' ], + 'interfaces' => [ 'Node', 'Product' ], 'fields' => self::get_fields(), 'resolveType' => [ Core::class, 'resolve_product_type' ], ] diff --git a/includes/type/interface/class-product-with-variations.php b/includes/type/interface/class-product-with-variations.php index 22446366..c337c5e1 100644 --- a/includes/type/interface/class-product-with-variations.php +++ b/includes/type/interface/class-product-with-variations.php @@ -29,7 +29,7 @@ public static function register_interface(): void { 'ProductWithVariations', [ 'description' => __( 'A product with variations.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node' ], + 'interfaces' => [ 'Node', 'Product' ], 'fields' => self::get_fields(), 'connections' => self::get_connections(), 'resolveType' => [ Core::class, 'resolve_product_type' ], diff --git a/includes/type/interface/class-product.php b/includes/type/interface/class-product.php index a3cf4840..afcf7c13 100644 --- a/includes/type/interface/class-product.php +++ b/includes/type/interface/class-product.php @@ -201,6 +201,10 @@ public static function get_fields() { 'type' => 'Boolean', 'description' => __( 'Can product be purchased?', 'wp-graphql-woocommerce' ), ], + 'virtual' => [ + 'type' => 'Boolean', + 'description' => __( 'Is product virtual?', 'wp-graphql-woocommerce' ), + ], 'metaData' => \WPGraphQL\WooCommerce\Type\WPObject\Meta_Data_Type::get_metadata_field_definition(), ]; } From 26d3a192285c2419ab10a75632170945f05ea49c Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Tue, 29 Oct 2024 15:42:18 -0400 Subject: [PATCH 2/3] fix: more inconsistencies fixed. --- composer.json | 3 +- includes/connection/class-orders.php | 7 ++-- .../connection/class-product-attributes.php | 36 ++++++++----------- includes/connection/class-products.php | 4 +-- .../interface/class-product-variation.php | 18 ++++++++++ .../class-product-with-attributes.php | 16 +++++++++ tests/wpunit/ProductAttributeQueriesTest.php | 12 ++++--- 7 files changed, 64 insertions(+), 32 deletions(-) diff --git a/composer.json b/composer.json index 3aa7124a..5936d4d1 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,8 @@ "allow-plugins": { "johnpbloch/wordpress-core-installer": true, "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "composer/installers": true } }, "autoload": { diff --git a/includes/connection/class-orders.php b/includes/connection/class-orders.php index ded8fd07..c270c33f 100644 --- a/includes/connection/class-orders.php +++ b/includes/connection/class-orders.php @@ -146,10 +146,11 @@ private static function get_customer_refund_connection( $resolver, $customer ) { $customer_id = $customer->get_id(); $billing_email = $customer->get_billing_email(); if ( ! empty( $customer_id ) ) { - $args = [ + $args = [ 'customer_id' => $customer_id, 'return' => 'ids', ]; + /** @var array $order_ids_by_customer_id */ $order_ids_by_customer_id = wc_get_orders( $args ); if ( is_array( $order_ids_by_customer_id ) ) { @@ -158,10 +159,11 @@ private static function get_customer_refund_connection( $resolver, $customer ) { } if ( ! empty( $billing_email ) ) { - $args = [ + $args = [ 'billing_email' => $billing_email, 'return' => 'ids', ]; + /** @var array $order_ids_by_email */ $order_ids_by_email = wc_get_orders( $args ); // Merge the arrays of order IDs. if ( is_array( $order_ids_by_email ) ) { @@ -182,6 +184,7 @@ private static function get_customer_refund_connection( $resolver, $customer ) { ( 0 !== $customer_id && \WC()->customer->get_id() === $customer_id ) || \WC()->customer->get_billing_email() === $billing_email ); + $resolver->set_query_arg( 'post_parent__in', array_map( 'absint', $order_ids ) ); // Execute and return connection. diff --git a/includes/connection/class-product-attributes.php b/includes/connection/class-product-attributes.php index 0061a62b..d7f89a7e 100644 --- a/includes/connection/class-product-attributes.php +++ b/includes/connection/class-product-attributes.php @@ -10,6 +10,7 @@ namespace WPGraphQL\WooCommerce\Connection; +use GraphQL\Error\Error; use GraphQL\Type\Definition\ResolveInfo; use WPGraphQL\AppContext; use WPGraphQL\WooCommerce\Data\Connection\Product_Attribute_Connection_Resolver; @@ -24,15 +25,11 @@ class Product_Attributes { * @return void */ public static function register_connections() { - // From Product to ProductAttribute. - register_graphql_connection( - self::get_connection_config() - ); - // From Product to LocalProductAttribute. register_graphql_connection( self::get_connection_config( [ + 'fromType' => 'Product', 'toType' => 'LocalProductAttribute', 'fromFieldName' => 'localAttributes', 'connectionArgs' => [], @@ -44,6 +41,7 @@ public static function register_connections() { register_graphql_connection( self::get_connection_config( [ + 'fromType' => 'Product', 'toType' => 'GlobalProductAttribute', 'fromFieldName' => 'globalAttributes', 'connectionArgs' => [], @@ -57,15 +55,23 @@ public static function register_connections() { * with the defaults. * * @param array $args - Connection configuration. + * @throws \GraphQL\Error\Error If the "fromType" or "toType" is not provided. + * * @return array */ public static function get_connection_config( $args = [] ): array { + if ( ! isset( $args['fromType'] ) ) { + throw new Error( __( 'The "fromType" is required for the ProductAttributes connection.', 'wp-graphql-woocommerce' ) ); + } + + if ( ! isset( $args['toType'] ) ) { + throw new Error( __( 'The "toType" is required for the ProductAttributes connection.', 'wp-graphql-woocommerce' ) ); + } + return array_merge( [ - 'fromType' => 'Product', - 'toType' => 'ProductAttribute', 'fromFieldName' => 'attributes', - 'connectionArgs' => self::get_connection_args(), + 'connectionArgs' => [], 'resolve' => static function ( $source, array $args, AppContext $context, ResolveInfo $info ) { $resolver = new Product_Attribute_Connection_Resolver(); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase @@ -82,18 +88,4 @@ public static function get_connection_config( $args = [] ): array { $args ); } - - /** - * Returns array of where args. - * - * @return array - */ - public static function get_connection_args(): array { - return [ - 'type' => [ - 'type' => 'ProductAttributeTypesEnum', - 'description' => __( 'Filter results by attribute scope.', 'wp-graphql-woocommerce' ), - ], - ]; - } } diff --git a/includes/connection/class-products.php b/includes/connection/class-products.php index 67d04f98..17894114 100644 --- a/includes/connection/class-products.php +++ b/includes/connection/class-products.php @@ -148,8 +148,8 @@ static function () { register_graphql_connection( [ - 'fromType' => 'ProductVariation', - 'toType' => 'VariableProduct', + 'fromType' => 'Product', + 'toType' => 'Product', 'fromFieldName' => 'parent', 'description' => __( 'The parent of the node. The parent object can be of various types', 'wp-graphql-woocommerce' ), 'oneToOne' => true, diff --git a/includes/type/interface/class-product-variation.php b/includes/type/interface/class-product-variation.php index 7efb6c6b..e7665f92 100644 --- a/includes/type/interface/class-product-variation.php +++ b/includes/type/interface/class-product-variation.php @@ -11,9 +11,11 @@ use GraphQL\Type\Definition\ResolveInfo; use WPGraphQL\AppContext; use WPGraphQL\WooCommerce\Core_Schema_Filters as Core; +use WPGraphQL\WooCommerce\Data\Connection\Product_Connection_Resolver; use WPGraphQL\WooCommerce\Data\Connection\Variation_Attribute_Connection_Resolver; use WPGraphQL\WooCommerce\Type\WPObject\Meta_Data_Type; + /** * Class Product_Variation */ @@ -285,6 +287,22 @@ public static function get_connections() { return $resolver->resolve( $source, $args, $context, $info ); }, ], + 'parent' => [ + 'toType' => 'Product', + 'description' => __( 'The parent of the variation', 'wp-graphql-woocommerce' ), + 'oneToOne' => true, + 'queryClass' => '\WC_Product_Query', + 'resolve' => static function ( $source, $args, AppContext $context, ResolveInfo $info ) { + if ( empty( $source->parent_id ) ) { + return null; + } + + $resolver = new Product_Connection_Resolver( $source, $args, $context, $info ); + $resolver->set_query_arg( 'p', $source->parent_id ); + + return $resolver->one_to_one()->get_connection(); + }, + ], ]; } } diff --git a/includes/type/interface/class-product-with-attributes.php b/includes/type/interface/class-product-with-attributes.php index cb8356e9..b8139889 100644 --- a/includes/type/interface/class-product-with-attributes.php +++ b/includes/type/interface/class-product-with-attributes.php @@ -11,6 +11,7 @@ use GraphQL\Type\Definition\ResolveInfo; use WPGraphQL\AppContext; use WPGraphQL\WooCommerce\Core_Schema_Filters as Core; +use WPGraphQL\WooCommerce\Data\Connection\Product_Attribute_Connection_Resolver; use WPGraphQL\WooCommerce\Data\Connection\Variation_Attribute_Connection_Resolver; /** @@ -67,6 +68,21 @@ public static function get_connections() { 'resolve' => static function ( $source, array $args, AppContext $context, ResolveInfo $info ) { $resolver = new Variation_Attribute_Connection_Resolver(); + return $resolver->resolve( $source, $args, $context, $info ); + }, + ], + 'attributes' => [ + 'toType' => 'ProductAttribute', + 'fromFieldName' => 'attributes', + 'connectionArgs' => [ + 'type' => [ + 'type' => 'ProductAttributeTypesEnum', + 'description' => __( 'Filter results by attribute scope.', 'wp-graphql-woocommerce' ), + ], + ], + 'resolve' => static function ( $source, array $args, AppContext $context, ResolveInfo $info ) { + $resolver = new Product_Attribute_Connection_Resolver(); + return $resolver->resolve( $source, $args, $context, $info ); }, ], diff --git a/tests/wpunit/ProductAttributeQueriesTest.php b/tests/wpunit/ProductAttributeQueriesTest.php index 189229be..acd201ca 100644 --- a/tests/wpunit/ProductAttributeQueriesTest.php +++ b/tests/wpunit/ProductAttributeQueriesTest.php @@ -179,11 +179,13 @@ public function testProductAttributeMatchesVariationAttributeCounterpart() { query attributeQuery( $id: ID! ) { product( id: $id ) { id - attributes { - nodes { - name - label - options + ... on ProductWithAttributes { + attributes { + nodes { + name + label + options + } } } ... on ProductWithVariations { From 2dedda407c2f54d5d429f58414b82d347976bd5b Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Tue, 5 Nov 2024 14:15:46 -0500 Subject: [PATCH 3/3] feat: "ProductWithAttributes" interface radded to "ProductWithVariations" interface --- includes/type/interface/class-product-with-variations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/type/interface/class-product-with-variations.php b/includes/type/interface/class-product-with-variations.php index c337c5e1..7af6b05d 100644 --- a/includes/type/interface/class-product-with-variations.php +++ b/includes/type/interface/class-product-with-variations.php @@ -29,7 +29,7 @@ public static function register_interface(): void { 'ProductWithVariations', [ 'description' => __( 'A product with variations.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node', 'Product' ], + 'interfaces' => [ 'Node', 'Product', 'ProductWithAttributes' ], 'fields' => self::get_fields(), 'connections' => self::get_connections(), 'resolveType' => [ Core::class, 'resolve_product_type' ],