diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 855da13f..5d0d9c8b 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -36,7 +36,7 @@ jobs: composer install - name: Cache dependencies - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} diff --git a/includes/class-core-schema-filters.php b/includes/class-core-schema-filters.php index c8045ae2..0a69ee36 100644 --- a/includes/class-core-schema-filters.php +++ b/includes/class-core-schema-filters.php @@ -127,7 +127,7 @@ public static function register_post_types( $args, $post_type ) { $args['graphql_single_name'] = 'Product'; $args['graphql_plural_name'] = 'Products'; $args['graphql_kind'] = 'interface'; - $args['graphql_interfaces'] = [ 'ContentNode' ]; + $args['graphql_interfaces'] = [ 'ContentNode', 'ProductUnion' ]; $args['graphql_register_root_field'] = false; $args['graphql_register_root_connection'] = false; $args['graphql_resolve_type'] = [ self::class, 'resolve_product_type' ]; @@ -143,8 +143,8 @@ public static function register_post_types( $args, $post_type ) { 'Node', 'NodeWithFeaturedImage', 'ContentNode', - 'UniformResourceIdentifiable', 'ProductUnion', + 'UniformResourceIdentifiable', 'ProductWithPricing', 'ProductWithDimensions', 'InventoriedProduct', diff --git a/includes/type/interface/class-downloadable-product.php b/includes/type/interface/class-downloadable-product.php index cf57c2dd..b2c72ee9 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', 'Product' ], + 'interfaces' => [ 'Node' ], 'fields' => self::get_fields(), 'resolveType' => [ Core::class, 'resolve_product_type' ], ] diff --git a/includes/type/interface/class-inventoried-product.php b/includes/type/interface/class-inventoried-product.php index e8a11f8e..44fcfa8c 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', 'Product' ], + 'interfaces' => [ 'Node' ], '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 100b23a0..6477af97 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', 'Product' ], + 'interfaces' => [ 'Node' ], '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 b8139889..1bcaa6bf 100644 --- a/includes/type/interface/class-product-with-attributes.php +++ b/includes/type/interface/class-product-with-attributes.php @@ -29,7 +29,7 @@ public static function register_interface(): void { 'ProductWithAttributes', [ 'description' => __( 'Products with default attributes.', 'wp-graphql-woocommerce' ), - 'interfaces' => [ 'Node', 'Product' ], + 'interfaces' => [ 'Node' ], '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 65d4717c..3a125df6 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', 'Product' ], + 'interfaces' => [ 'Node' ], '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 ae9e586b..0e1a4753 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', 'Product' ], + 'interfaces' => [ 'Node' ], '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 7af6b05d..bda2197d 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', 'ProductWithAttributes' ], + 'interfaces' => [ 'Node', 'ProductWithAttributes' ], 'fields' => self::get_fields(), 'connections' => self::get_connections(), 'resolveType' => [ Core::class, 'resolve_product_type' ], diff --git a/tests/wpunit/ProductQueriesTest.php b/tests/wpunit/ProductQueriesTest.php index 1c166537..b4607c15 100644 --- a/tests/wpunit/ProductQueriesTest.php +++ b/tests/wpunit/ProductQueriesTest.php @@ -960,6 +960,7 @@ public function testProductQueryWithInterfaces() { reviewsAllowed purchaseNote menuOrder + virtual ... on ProductWithPricing { price regularPrice @@ -985,7 +986,6 @@ public function testProductQueryWithInterfaces() { shippingTaxable } ... on DownloadableProduct { - virtual downloadExpiry downloadable downloadLimit