mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
feat: WC Settings API, compatibility refactor, HPOS fix (#1002)
* feat: WC Settings API, compatibility refactor, HPOS fix, CI improvements WC Settings GraphQL API: - Add WCSetting interface with common fields and type-safe resolveType - Add concrete types: WCStringSetting, WCArraySetting, WCRelativeDateSetting, WCImageWidthSetting with typed value/default fields - Add WCSettingGroup type with nested settings field - Add wcSettingGroups and wcSettings root query fields (admin only) - Add updateWCSetting and updateWCSettings mutations - Dynamic WCSettingTypeEnum collected from registered WC settings - Filters: graphql_woocommerce_setting_type_map, graphql_woocommerce_setting_types - Register WC admin settings for GraphQL requests via Compatibility class Compatibility refactor: - Consolidate ACF, JWT Auth, and QL Search filters into Compatibility class - Remove class-acf-schema-filters.php, class-jwt-auth-schema-filters.php, functions.php HPOS compatibility fix: - Replace hardcoded directory name check with dirname(__DIR__) === WP_PLUGIN_DIR - Works with any plugin folder name while still skipping nested vendor installs CI improvements: - Remove STRIPE_API_PUBLISHABLE_KEY restriction from coverage job - Add HPOS to coverage matrix entries - Sort type registry and includes alphabetically Other fixes: - Fix Settings_Mutation::validate_setting_checkbox_field to be static - Update ShippingZone settings field type to WCStringSetting Closes #864, closes #969 * refactor: Rename and split core classes, add order cursor pagination tests Class renames: - WooCommerce_Filters → WooCommerce (class-woocommerce.php), setup() → init() - Core_Schema_Filters → Post_Types (class-post-types.php) Class split: - Extract taxonomy registration from Core_Schema_Filters into Taxonomies (class-taxonomies.php) Access functions: - Add wc_graphql_resolve_product_type() for interface resolveType callbacks - Add wc_graphql_is_session_handler_disabled() - Add wc_graphql_enabled_authorizing_url_fields() - Add wc_graphql_get_authorizing_url_nonce_param_name() - Replace direct class references with global functions in type-registry, compatibility, protected-router, and all product interface files Stripe gateway compatibility: - Move woographql_stripe_gateway_args from WooCommerce to Compatibility class - Rename to woocommerce_gateway_stripe_args Tests: - Add OrderCursorPaginationTest (6 tests) covering COT cursor-based pagination: forward/backward, date ordering ASC/DESC, cursor integrity * fix: Use proper expectedField/expectedNode assertions in cursor pagination tests Replace empty assertQuerySuccessful([]) calls and manual lodashGet assertions with expectedField, expectedNode, and not()->expectedNode() for proper GraphQL response validation.
This commit is contained in:
@@ -370,3 +370,51 @@ if ( ! function_exists( 'woographql_verify_nonce' ) ) :
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'wc_graphql_resolve_product_type' ) ) {
|
||||
/**
|
||||
* Resolves GraphQL type for provided product model.
|
||||
*
|
||||
* @param mixed $value Product model.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function wc_graphql_resolve_product_type( $value ) {
|
||||
return \WPGraphQL\WooCommerce\Post_Types::resolve_product_type( $value );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'wc_graphql_is_session_handler_disabled' ) ) {
|
||||
/**
|
||||
* Returns true if the QL Session Handler is disabled.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function wc_graphql_is_session_handler_disabled() {
|
||||
return \WPGraphQL\WooCommerce\WooCommerce::is_session_handler_disabled();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'wc_graphql_enabled_authorizing_url_fields' ) ) {
|
||||
/**
|
||||
* Returns array of enabled authorizing URL field slugs.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function wc_graphql_enabled_authorizing_url_fields() {
|
||||
return \WPGraphQL\WooCommerce\WooCommerce::enabled_authorizing_url_fields();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'wc_graphql_get_authorizing_url_nonce_param_name' ) ) {
|
||||
/**
|
||||
* Return the nonce query parameter name for the provided field.
|
||||
*
|
||||
* @param string $field URL field slug.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function wc_graphql_get_authorizing_url_nonce_param_name( $field ) {
|
||||
return \WPGraphQL\WooCommerce\WooCommerce::get_authorizing_url_nonce_param_name( $field );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user