Skip to content

ProductCategoryToProductConnectionWhereArgs using PostObjectsConnectionOrderbyInput for orderby field #694

@lstellway

Description

@lstellway

Describe the bug

I recently upgraded the wp-graphql(-woocommerce) dependencies for my project and noticed a custom product orderby field I built is no longer working.

After some digging, I noticed it still works on RootQueryToProductConnection, but not on ProductCategoryToProductConnection. I found thatRootQueryToProductConnectionWhereArgs is currently utilizing ProductsOrderbyInput for the orderby field, while ProductCategoryToProductConnectionWhereArgs utilizes PostObjectsConnectionOrderbyInput.

Is this intentional? Possible oversight? I'm working to familiarize myself with the plugin structure, but thought I'd bring it up in case:

  1. It's an actual issue
  2. Anybody has familiarity and may be able to save me some time 😅.

To Reproduce

I'm utilizing the Products_orderby_enum_values filter to add an order by field:

class Example { public function __construct() { add_filter('Products_orderby_enum_values', [$this, 'addProductOrderByValues']); } public function addProductOrderByValues($values) { $values['STOCK_STATUS'] = [ 'value' => '_stock_status', 'description' => __('Order by product\'s stock status', 'backroads'), ]; return $values; } }

I am using Apollo GraphQL Studio to inspect my GraphQL API running locally.

Expected behavior

I'd expect the product filtering to have the same options for both the root connection and product category connections as it was before. The PostObjectsConnectionOrderbyInput type for the orderby field looks suspicious.

Plugin Versions

Name Version
WooGraphQL v0.12.0
WPGraphQL v1.13.7
WordPress 6.1.1
WooCommerce 7.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions