* Add option to Change the created_via field.
Can be useful when WooCommerce is being used from multiply sources. For example, with plugins like Point of Sale for WooCommerce.
* feat: createdVia on checkout + WooCommerce order attribution origin
Builds on the createOrder createdVia option:
- Add a createdVia input to the checkout mutation. WC_Checkout::create_order()
hardcodes created_via to 'checkout' after its data loop, so process_checkout()
overrides it (and tags the attribution source type) only when createdVia is
provided; otherwise checkout keeps WooCommerce's 'checkout' default.
- createOrder now defaults created_via to WooCommerce::get_order_attribution_source_type()
('graphql-api', filterable) and writes that value to the
_wc_order_attribution_source_type order meta so GraphQL orders are attributable.
- Register a wc_order_attribution_origin_label callback that brands orders
attributed to 'graphql-api' as the 'GraphQL' origin in WooCommerce admin.
- Cover createdVia + attribution in OrderMutationsTest and CheckoutMutationTest.
---------
Co-authored-by: Scott Kennedy <scottyzen@gmail.com>
* feat: persist shipping phone through the checkout mutation
The shipping fieldset in Checkout_Mutation::get_checkout_fields() omitted
the phone field, so a phone passed in the checkout mutation's shipping
input was never mapped into shipping_phone and WC_Order::set_shipping_phone()
was never called. Add phone to the shipping fieldset so it flows through to
the order, matching the billing fieldset.
Closes#1016
* fix: load QL session handler when a session token header is present
should_load_session_handler() only matched explicit wc-ajax / WC_DOING_AJAX
and REST_REQUEST contexts. Headless callers drive session state through the
Store-API Cart-Token header or the legacy woocommerce-session header and can
land on other admin-ajax/REST entrypoints, leaving the session bootstrapped
from an absent cookie. Detect either session header and also honor
wp_doing_ajax() so QL_Session_Handler loads and rebuilds the session from the
token.
* ci: authenticate composer GitHub access to fix flaky strauss install
The dependency-install steps run with the github-oauth token that composer
rejects ("contains invalid characters"), so composer and strauss's internal
composer bootstrap fall back to unauthenticated GitHub access. Under the
shared runner IP's 60/hr unauthenticated rate limit, strauss intermittently
exits 1 during post-install-cmd, failing lint, PHPStan, wpunit, functional
and acceptance jobs at random.
Provide a well-formed COMPOSER_AUTH built from the always-available
GITHUB_TOKEN on every dependency-install step so GitHub API access is
authenticated (5000/hr), removing the flake.
* ci: run strauss with a clean composer auth context
setup-php writes the runner's GITHUB_TOKEN into composer's global auth.json,
and this composer rejects that token format ("github oauth token contains
invalid characters"). strauss spins up its own internal Composer instance,
which reads that auth, hits the validation error and exits 1 with no output,
failing every job at the post-install/post-update strauss step.
strauss only rewrites local vendor packages and needs no GitHub auth, so run
it with COMPOSER_AUTH unset and a throwaway COMPOSER_HOME. Fixes all CI
install steps, local installs and release packaging from one place.
This reverts the earlier per-workflow COMPOSER_AUTH attempt, which could not
work because composer rejects the token regardless of how it is supplied.
* style: align equals sign in should_load_session_handler (phpcs)
* 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.
* fix: refresh order object after meta save in checkout mutation
The woocommerce_checkout_order_processed hook was receiving a stale
order object without the metadata saved by update_order_meta().
Refreshing the order via wc_get_order() after meta save ensures
plugins hooking into woocommerce_checkout_order_processed can access
the checkout metadata.
Resolves#932
* chore: Linter compliances met
* fix: resolve REQUEST_URI fatal error and JWT key length issues in CI
QLSessionHandlerTest::tearDown() was calling unset($_SERVER) which
destroyed the entire superglobal. WordPress cron.php then fataled on
shutdown when accessing $_SERVER['REQUEST_URI']. Changed to only unset
the specific HTTP_WOOCOMMERCE_SESSION key.
Also updated JWT secret keys to meet firebase/php-jwt v7's minimum
32-byte requirement for HS256 in both test config and Docker entrypoint.
* fix: the rest of the files added
* devops: php7.4 removed from matrix
* chore: Linter compliances met
* devops: More broken test updated
* devops: Tests updated for CI
* fix: QLSessionHandlerCest fixed
* fix: QLSessionHandlerCest fixed
* devops: CI fixed
* - remove several fields that are already registered by core when the post type is mapped to the schema
* devops: Tests updated and coupon "salt" restored
* chore: Linter & PHPStan compliance met
* chore: Linter & PHPStan compliance met
* devops: "self" replaced with "static" in cli tests
* chore: fix cleanup after rebasing
---------
Co-authored-by: Geoff Taylor <geoff@axistaylor.com>
* feat: "product" and "variation" connections added to LineItem type
* chore: Coding standards met
* fix: GraphQLE2E helper updated to reflect schema changes
* chore: PHP 8.0 compliance met
* chore: Workflow codecoverage set to target PHP 7.4
* chore: WPCS compliance met
* fix: Huge refactor across schema and unit tests
* - add shipping_method loader in class-core-schema-filters.php
* - Update class-wc-db-loader.php to respect the new SHIPPING_METHOD loader with a `load_shipping_method_from_id()` function
* - Convert Shipping_Method_Connection_Resolver to extend AbstractConnectionResolver
* - Replace resolver for Shipping Methods connection. Remove use of `resolveNode` and replace the resolver with the new connection class `get_connection()` call
* chore: Factory class refactored.
* - update the function that registers Product Types to the Schema to use the value from the `get_enabled_product_types()` as the Type name and the key as the fieldName
* chore: PaymentGatewayQueriesTest refactored.
* chore: WPCS compliance met
* chore: Syntax error fixed.
Co-authored-by: Jason Bahl <jasonbahl@mac.com>