mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
Several new WPEnumType and WPInputObject types implemented.
This commit is contained in:
+4
-1
@@ -16,7 +16,7 @@
|
||||
"license": "GPL-3.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "kidunot89",
|
||||
"name": "Geoff Taylor",
|
||||
"email": "kidunot89@gmail.com",
|
||||
"role": "Lead developer"
|
||||
}
|
||||
@@ -31,6 +31,9 @@
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"autoload": {
|
||||
"files":[
|
||||
"includes/connection/common-post-type-args.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"WPGraphQL\\Extensions\\WooCommerce\\": "includes/"
|
||||
},
|
||||
|
||||
@@ -36,16 +36,17 @@ class Type_Registry {
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Stock_Status::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Class::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Status::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\WC_Connection_Orderby_Enum::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Rate_Connection_Orderby_Enum::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Pricing_Field_Format::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Product_Taxonomy::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Taxonomy_Operator::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Post_Type_Orderby_Enum::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Products_Orderby_Enum::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Orders_Orderby_Enum::register();
|
||||
|
||||
// InputObjects.
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Customer_Address_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Product_Attribute_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\WC_Connection_Orderby_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Tax_Rate_Connection_Orderby_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Fee_Line_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Line_Item_Input::register();
|
||||
@@ -55,6 +56,7 @@ class Type_Registry {
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Cart_Item_Quantity_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Product_Taxonomy_Filter_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Product_Taxonomy_Filter_Relation_Input::register();
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Orderby_Inputs::register();
|
||||
|
||||
// Objects.
|
||||
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Coupon_Type::register();
|
||||
|
||||
@@ -14,7 +14,7 @@ use WPGraphQL\Extensions\WooCommerce\Data\Factory;
|
||||
/**
|
||||
* Class - Coupons
|
||||
*/
|
||||
class Coupons extends WC_Connection {
|
||||
class Coupons {
|
||||
/**
|
||||
* Registers the various connections from other Types to Coupon
|
||||
*/
|
||||
@@ -65,7 +65,7 @@ class Coupons extends WC_Connection {
|
||||
*/
|
||||
public static function get_connection_args() {
|
||||
return array_merge(
|
||||
self::get_shared_connection_args(),
|
||||
get_common_post_type_args(),
|
||||
array(
|
||||
'code' => array(
|
||||
'type' => 'String',
|
||||
|
||||
@@ -14,7 +14,7 @@ use WPGraphQL\Extensions\WooCommerce\Data\Factory;
|
||||
/**
|
||||
* Class - Orders
|
||||
*/
|
||||
class Orders extends WC_Connection {
|
||||
class Orders {
|
||||
/**
|
||||
* Registers the various connections from other Types to Customer
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ class Orders extends WC_Connection {
|
||||
*/
|
||||
public static function get_connection_args() {
|
||||
return array_merge(
|
||||
self::get_shared_connection_args(),
|
||||
get_common_post_type_args(),
|
||||
array(
|
||||
'statuses' => array(
|
||||
'type' => array( 'list_of' => 'OrderStatusEnum' ),
|
||||
@@ -82,6 +82,10 @@ class Orders extends WC_Connection {
|
||||
'type' => 'Int',
|
||||
'description' => __( 'Limit result set to orders assigned a specific product.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'orderby' => array(
|
||||
'type' => array( 'list_of' => 'OrdersOrderbyInput' ),
|
||||
'description' => __( 'What paramater to use to order the objects by.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use WPGraphQL\Extensions\WooCommerce\Data\Factory;
|
||||
/**
|
||||
* Class - Products
|
||||
*/
|
||||
class Products extends WC_Connection {
|
||||
class Products {
|
||||
/**
|
||||
* Registers the various connections from other Types to Product
|
||||
*/
|
||||
@@ -274,6 +274,10 @@ class Products extends WC_Connection {
|
||||
'type' => array( 'list_of' => 'ProductTaxonomyFilterRelationInput' ),
|
||||
'description' => __( 'Limit result set with complex set of taxonomy filters.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'orderby' => array(
|
||||
'type' => array( 'list_of' => 'ProductsOrderbyInput' ),
|
||||
'description' => __( 'What paramater to use to order the objects by.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( wc_tax_enabled() ) {
|
||||
@@ -283,6 +287,6 @@ class Products extends WC_Connection {
|
||||
);
|
||||
}
|
||||
|
||||
return array_merge( self::get_shared_connection_args(), $args );
|
||||
return array_merge( get_common_post_type_args(), $args );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use WPGraphQL\Extensions\WooCommerce\Data\Factory;
|
||||
/**
|
||||
* Class - Refunds
|
||||
*/
|
||||
class Refunds extends WC_Connection {
|
||||
class Refunds {
|
||||
/**
|
||||
* Registers the various connections from other Types to Refund
|
||||
*/
|
||||
@@ -66,7 +66,7 @@ class Refunds extends WC_Connection {
|
||||
*/
|
||||
public static function get_connection_args() {
|
||||
return array_merge(
|
||||
self::get_shared_connection_args(),
|
||||
get_common_post_type_args(),
|
||||
array(
|
||||
'statuses' => array(
|
||||
'type' => array( 'list_of' => 'String' ),
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Connection Trait - WC_Connection
|
||||
*
|
||||
* Defines shared functionality for WooCommerce connection definitions
|
||||
*
|
||||
* @package WPGraphQL\Extensions\WooCommerce\Connection
|
||||
* @since 0.0.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Connection;
|
||||
|
||||
/**
|
||||
* Class WC_Connection
|
||||
*/
|
||||
class WC_Connection {
|
||||
/**
|
||||
* Returns array of where args
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_shared_connection_args() {
|
||||
return array(
|
||||
'search' => array(
|
||||
'type' => 'String',
|
||||
'description' => __( 'Limit results to those matching a string.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'exclude' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Ensure result set excludes specific IDs.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'include' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Limit result set to specific ids.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'orderby' => array(
|
||||
'type' => array( 'list_of' => 'WCConnectionOrderbyInput' ),
|
||||
'description' => __( 'What paramater to use to order the objects by.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'dateQuery' => array(
|
||||
'type' => 'DateQueryInput',
|
||||
'description' => __( 'Filter the connection based on dates', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'parent' => array(
|
||||
'type' => 'Int',
|
||||
'description' => __( 'Use ID to return only children. Use 0 to return only top-level items', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'parentIn' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Specify objects whose parent is in an array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'parentNotIn' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Specify objects whose parent is not in an array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Define common arguments for post-type connections.
|
||||
*
|
||||
* @package WPGraphQL\Extensions\WooCommerce\Connection
|
||||
* @since 0.2.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Connection;
|
||||
|
||||
/**
|
||||
* Returns argument definitions for argument common on all post-type connections.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_common_post_type_args() {
|
||||
return array(
|
||||
'search' => array(
|
||||
'type' => 'String',
|
||||
'description' => __( 'Limit results to those matching a string.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'exclude' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Ensure result set excludes specific IDs.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'include' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Limit result set to specific ids.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'orderby' => array(
|
||||
'type' => array( 'list_of' => 'PostTypeOrderbyInput' ),
|
||||
'description' => __( 'What paramater to use to order the objects by.', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'dateQuery' => array(
|
||||
'type' => 'DateQueryInput',
|
||||
'description' => __( 'Filter the connection based on dates', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'parent' => array(
|
||||
'type' => 'Int',
|
||||
'description' => __( 'Use ID to return only children. Use 0 to return only top-level items', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'parentIn' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Specify objects whose parent is in an array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'parentNotIn' => array(
|
||||
'type' => array( 'list_of' => 'Int' ),
|
||||
'description' => __( 'Specify objects whose parent is not in an array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ use WPGraphQL\Extension\WooCommerce\Model\Order;
|
||||
* Class Coupon_Connection_Resolver
|
||||
*/
|
||||
class Coupon_Connection_Resolver extends AbstractConnectionResolver {
|
||||
use WC_Connection_Resolver {
|
||||
sanitize_input_fields as sanitize_shared_input_fields;
|
||||
}
|
||||
use Common_CPT_Input_Sanitize_Functions;
|
||||
|
||||
/**
|
||||
* The name of the post type, or array of post types the connection resolver is resolving for
|
||||
@@ -168,6 +166,15 @@ class Coupon_Connection_Resolver extends AbstractConnectionResolver {
|
||||
return ! empty( $this->query->posts ) ? $this->query->posts : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns meta keys to be used for connection ordering.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ordering_meta() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Query
|
||||
* friendly keys. There's probably a cleaner/more dynamic way to approach this, but
|
||||
@@ -179,7 +186,7 @@ class Coupon_Connection_Resolver extends AbstractConnectionResolver {
|
||||
* @return array
|
||||
*/
|
||||
public function sanitize_input_fields( array $where_args ) {
|
||||
$args = $this->sanitize_shared_input_fields( $where_args );
|
||||
$args = $this->sanitize_common_inputs( $where_args );
|
||||
|
||||
if ( ! empty( $where_args['code'] ) ) {
|
||||
$id = \wc_get_coupon_id_by_code( $where_args['code'] );
|
||||
|
||||
@@ -19,9 +19,7 @@ use WPGraphQL\Extensions\WooCommerce\Model\Customer;
|
||||
* Class Order_Connection_Resolver
|
||||
*/
|
||||
class Order_Connection_Resolver extends AbstractConnectionResolver {
|
||||
use WC_Connection_Resolver {
|
||||
sanitize_input_fields as sanitize_shared_input_fields;
|
||||
}
|
||||
use Common_CPT_Input_Sanitize_Functions;
|
||||
|
||||
/**
|
||||
* The name of the post type, or array of post types the connection resolver is resolving for
|
||||
@@ -169,6 +167,22 @@ class Order_Connection_Resolver extends AbstractConnectionResolver {
|
||||
return ! empty( $this->query->get_orders() ) ? $this->query->get_orders() : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns meta keys to be used for connection ordering.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ordering_meta() {
|
||||
return array(
|
||||
'_order_key',
|
||||
'_cart_discount',
|
||||
'_order_total',
|
||||
'_order_tax',
|
||||
'_date_paid',
|
||||
'_date_completed',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Query
|
||||
* friendly keys. There's probably a cleaner/more dynamic way to approach this, but
|
||||
@@ -181,7 +195,7 @@ class Order_Connection_Resolver extends AbstractConnectionResolver {
|
||||
*/
|
||||
public function sanitize_input_fields( array $where_args ) {
|
||||
global $wpdb;
|
||||
$args = $this->sanitize_shared_input_fields( $where_args );
|
||||
$args = $this->sanitize_common_inputs( $where_args );
|
||||
|
||||
$key_mapping = array(
|
||||
'post_parent' => 'parent',
|
||||
|
||||
@@ -22,9 +22,7 @@ use WPGraphQL\Model\Term;
|
||||
* Class Product_Connection_Resolver
|
||||
*/
|
||||
class Product_Connection_Resolver extends AbstractConnectionResolver {
|
||||
use WC_Connection_Resolver {
|
||||
sanitize_input_fields as sanitize_shared_input_fields;
|
||||
}
|
||||
use Common_CPT_Input_Sanitize_Functions;
|
||||
|
||||
/**
|
||||
* The name of the post type, or array of post types the connection resolver is resolving for
|
||||
@@ -166,6 +164,11 @@ class Product_Connection_Resolver extends AbstractConnectionResolver {
|
||||
$query_args['graphql_cursor_offset'] = $cursor_offset;
|
||||
$query_args['graphql_cursor_compare'] = ( ! empty( $last ) ) ? '>' : '<';
|
||||
|
||||
/**
|
||||
* Pass the graphql $args to the WP_Query
|
||||
*/
|
||||
$query_args['graphql_args'] = $this->args;
|
||||
|
||||
// Determine where we're at in the Graph and adjust the query context appropriately.
|
||||
if ( true === is_object( $this->source ) ) {
|
||||
switch ( true ) {
|
||||
@@ -244,11 +247,6 @@ class Product_Connection_Resolver extends AbstractConnectionResolver {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass the graphql $args to the WP_Query
|
||||
*/
|
||||
$query_args['graphql_args'] = $this->args;
|
||||
|
||||
if ( isset( $query_args['post__in'] ) && empty( $query_args['post__in'] ) ) {
|
||||
$query_args['post__in'] = array( '0' );
|
||||
}
|
||||
@@ -331,6 +329,24 @@ class Product_Connection_Resolver extends AbstractConnectionResolver {
|
||||
return ! empty( $this->query->posts ) ? $this->query->posts : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns meta keys to be used for connection ordering.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ordering_meta() {
|
||||
return array(
|
||||
'_price',
|
||||
'_regular_price',
|
||||
'_sale_price',
|
||||
'_wc_rating_count',
|
||||
'_wc_average_rating',
|
||||
'_sale_price_dates_from',
|
||||
'_sale_price_dates_to',
|
||||
'total_sales',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Query
|
||||
* friendly keys. There's probably a cleaner/more dynamic way to approach this, but
|
||||
@@ -342,7 +358,7 @@ class Product_Connection_Resolver extends AbstractConnectionResolver {
|
||||
* @return array
|
||||
*/
|
||||
public function sanitize_input_fields( array $where_args ) {
|
||||
$args = $this->sanitize_shared_input_fields( $where_args );
|
||||
$args = $this->sanitize_common_inputs( $where_args );
|
||||
|
||||
if ( ! empty( $where_args['slug'] ) ) {
|
||||
$args['name'] = $where_args['slug'];
|
||||
|
||||
@@ -20,9 +20,7 @@ use WPGraphQL\Extension\WooCommerce\Model\Order;
|
||||
* Class Refund_Connection_Resolver
|
||||
*/
|
||||
class Refund_Connection_Resolver extends AbstractConnectionResolver {
|
||||
use WC_Connection_Resolver {
|
||||
sanitize_input_fields as sanitize_shared_input_fields;
|
||||
}
|
||||
use Common_CPT_Input_Sanitize_Functions;
|
||||
|
||||
/**
|
||||
* The name of the post type, or array of post types the connection resolver is resolving for
|
||||
@@ -177,6 +175,15 @@ class Refund_Connection_Resolver extends AbstractConnectionResolver {
|
||||
return ! empty( $this->query->get_orders() ) ? $this->query->get_orders() : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns meta keys to be used for connection ordering.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ordering_meta() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Query
|
||||
* friendly keys. There's probably a cleaner/more dynamic way to approach this, but
|
||||
@@ -188,7 +195,7 @@ class Refund_Connection_Resolver extends AbstractConnectionResolver {
|
||||
* @return array
|
||||
*/
|
||||
public function sanitize_input_fields( array $where_args ) {
|
||||
$args = $this->sanitize_shared_input_fields( $where_args );
|
||||
$args = $this->sanitize_common_inputs( $where_args );
|
||||
|
||||
$key_mapping = array(
|
||||
'post_parent' => 'parent',
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Defines reusable function for sanitizing user input for post-type connections.
|
||||
*
|
||||
* @package WPGraphQL\Extensions\WooCommerce\Data\Connection
|
||||
* @since 0.2.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Data\Connection;
|
||||
|
||||
/**
|
||||
* Trait Common_CPT_Input_Sanitize_Functions
|
||||
*/
|
||||
trait Common_CPT_Input_Sanitize_Functions {
|
||||
/**
|
||||
* Sanitizes common post-type connection query input.
|
||||
*
|
||||
* @param array $input Input to be sanitize.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sanitize_common_inputs( array $input ) {
|
||||
$args = array();
|
||||
if ( ! empty( $input['include'] ) ) {
|
||||
$args['post__in'] = $input['include'];
|
||||
}
|
||||
|
||||
if ( ! empty( $input['exclude'] ) ) {
|
||||
$args['post__not_in'] = $input['exclude'];
|
||||
}
|
||||
|
||||
if ( ! empty( $input['parent'] ) ) {
|
||||
$args['post_parent'] = $input['parent'];
|
||||
}
|
||||
|
||||
if ( ! empty( $input['parentIn'] ) ) {
|
||||
if ( ! isset( $args['post_parent__in'] ) ) {
|
||||
$args['post_parent__in'] = array();
|
||||
}
|
||||
$args['post_parent__in'] = array_merge( $args['post_parent__in'], $input['parentIn'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $input['parentNotIn'] ) ) {
|
||||
$args['post_parent__not_in'] = $input['parentNotIn'];
|
||||
}
|
||||
|
||||
if ( ! empty( $input['search'] ) ) {
|
||||
$args['s'] = $input['search'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the orderby inputArgs to the WP_Query
|
||||
*/
|
||||
if ( ! empty( $input['orderby'] ) && is_array( $input['orderby'] ) ) {
|
||||
$args['orderby'] = array();
|
||||
foreach ( $input['orderby'] as $orderby_input ) {
|
||||
/**
|
||||
* These orderby options should not include the order parameter.
|
||||
*/
|
||||
if ( in_array(
|
||||
$orderby_input['field'],
|
||||
array( 'post__in', 'post_name__in', 'post_parent__in' ),
|
||||
true
|
||||
) ) {
|
||||
$args['orderby'] = esc_sql( $orderby_input['field'] );
|
||||
|
||||
// Handle meta fields.
|
||||
} elseif ( in_array( $orderby_input['field'], $this->ordering_meta(), true ) ) {
|
||||
$args['orderby'] = array( 'meta_value_num' => $orderby_input['order'] );
|
||||
$args['meta_key'] = esc_sql( $orderby_input['field'] ); // WPCS: slow query ok.
|
||||
|
||||
// Handle post object fields.
|
||||
} elseif ( ! empty( $orderby_input['field'] ) ) {
|
||||
$args['orderby'] = array(
|
||||
esc_sql( $orderby_input['field'] ) => esc_sql( $orderby_input['order'] ),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $input['dateQuery'] ) ) {
|
||||
$args['date_query'] = $input['dateQuery'];
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ConnectionResolver Trait - WC_Connection_Resolver
|
||||
*
|
||||
* Defines shared functionality for WooCommerce connection resolvers
|
||||
*
|
||||
* @package WPGraphQL\Extensions\WooCommerce\Data\Connection
|
||||
* @since 0.0.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Data\Connection;
|
||||
|
||||
/**
|
||||
* Trait WC_Connection_Resolver
|
||||
*/
|
||||
trait WC_Connection_Resolver {
|
||||
/**
|
||||
* This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Query
|
||||
* friendly keys. There's probably a cleaner/more dynamic way to approach this, but
|
||||
* this was quick. I'd be down to explore more dynamic ways to map this, but for
|
||||
* now this gets the job done.
|
||||
*
|
||||
* @param array $where_args - arguments being used to filter query.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sanitize_input_fields( array $where_args ) {
|
||||
$args = array();
|
||||
if ( ! empty( $where_args['include'] ) ) {
|
||||
$args['post__in'] = $where_args['include'];
|
||||
}
|
||||
|
||||
if ( ! empty( $where_args['exclude'] ) ) {
|
||||
$args['post__not_in'] = $where_args['exclude'];
|
||||
}
|
||||
|
||||
if ( ! empty( $where_args['parent'] ) ) {
|
||||
$args['post_parent'] = $where_args['parent'];
|
||||
}
|
||||
|
||||
if ( ! empty( $where_args['parentIn'] ) ) {
|
||||
if ( ! isset( $args['post_parent__in'] ) ) {
|
||||
$args['post_parent__in'] = array();
|
||||
}
|
||||
$args['post_parent__in'] = array_merge( $args['post_parent__in'], $where_args['parentIn'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $where_args['parentNotIn'] ) ) {
|
||||
$args['post_parent__not_in'] = $where_args['parentNotIn'];
|
||||
}
|
||||
|
||||
if ( ! empty( $where_args['search'] ) ) {
|
||||
$args['s'] = $where_args['search'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the orderby inputArgs to the WP_Query
|
||||
*/
|
||||
if ( ! empty( $where_args['orderby'] ) && is_array( $where_args['orderby'] ) ) {
|
||||
$args['orderby'] = array();
|
||||
foreach ( $where_args['orderby'] as $orderby_input ) {
|
||||
/**
|
||||
* These orderby options should not include the order parameter.
|
||||
*/
|
||||
if ( in_array(
|
||||
$orderby_input['field'],
|
||||
array( 'post__in', 'post_name__in', 'post_parent__in' ),
|
||||
true
|
||||
) ) {
|
||||
$args['orderby'] = esc_sql( $orderby_input['field'] );
|
||||
} elseif ( in_array(
|
||||
$orderby_input['field'],
|
||||
array( '_price', '_regular_price', '_sale_price' ),
|
||||
true
|
||||
) ) {
|
||||
$args['orderby'] = array( 'meta_value_num' => $orderby_input['order'] );
|
||||
$args['meta_key'] = esc_sql( $orderby_input['field'] ); // WPCS: slow query ok.
|
||||
} elseif ( ! empty( $orderby_input['field'] ) ) {
|
||||
$args['orderby'] = array(
|
||||
esc_sql( $orderby_input['field'] ) => esc_sql( $orderby_input['order'] ),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $where_args['dateQuery'] ) ) {
|
||||
$args['date_query'] = $where_args['dateQuery'];
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* WPEnum Type - OrdersOrderbyEnum
|
||||
*
|
||||
* @package \WPGraphQL\Extensions\WooCommerce\Type\WPEnum
|
||||
* @since 0.2.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Type\WPEnum;
|
||||
|
||||
/**
|
||||
* Class Orders_Orderby_Enum
|
||||
*/
|
||||
class Orders_Orderby_Enum extends Post_Type_Orderby_Enum {
|
||||
/**
|
||||
* Holds ordering enumeration base name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $name = 'Orders';
|
||||
|
||||
/**
|
||||
* Define enumeration values related to the "shop_order" post-type ordering fields.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values() {
|
||||
return array_merge(
|
||||
self::post_type_values(),
|
||||
array(
|
||||
'ORDER_KEY' => array(
|
||||
'value' => '_order_key',
|
||||
'description' => __( 'Order by order key', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'DISCOUNT' => array(
|
||||
'value' => '_cart_discount',
|
||||
'description' => __( 'Order by order discount amount', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'TOTAL' => array(
|
||||
'value' => '_order_total',
|
||||
'description' => __( 'Order by order total', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'TAX' => array(
|
||||
'value' => '_order_tax',
|
||||
'description' => __( 'Order by order total', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'DATE_PAID' => array(
|
||||
'value' => '_date_paid',
|
||||
'description' => __( 'Order by date the order was paid', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'DATE_COMPLETED' => array(
|
||||
'value' => '_date_completed',
|
||||
'description' => __( 'Order by date the order was completed', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* WPEnum type - Post_Type_Orderby_Enum
|
||||
* Defines common post-type ordering fields
|
||||
*
|
||||
* @package \WPGraphQL\Extensions\WooCommerce\Type\WPEnum
|
||||
* @since 0.2.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Type\WPEnum;
|
||||
|
||||
/**
|
||||
* Class Post_Type_Orderby_Enum
|
||||
*/
|
||||
class Post_Type_Orderby_Enum {
|
||||
/**
|
||||
* Holds ordering enumeration base name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $name = 'PostType';
|
||||
|
||||
/**
|
||||
* Defines enumeration value definitions for common post-type ordering fields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function post_type_values() {
|
||||
return array(
|
||||
'SLUG' => array(
|
||||
'value' => 'post_name',
|
||||
'description' => __( 'Order by slug', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'MODIFIED' => array(
|
||||
'value' => 'post_modified',
|
||||
'description' => __( 'Order by last modified date', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'DATE' => array(
|
||||
'value' => 'post_date',
|
||||
'description' => __( 'Order by publish date', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'PARENT' => array(
|
||||
'value' => 'post_parent',
|
||||
'description' => __( 'Order by parent ID', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'IN' => array(
|
||||
'value' => 'post__in',
|
||||
'description' => __( 'Preserve the ID order given in the IN array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'NAME_IN' => array(
|
||||
'value' => 'post_name__in',
|
||||
'description' => __( 'Preserve slug order given in the NAME_IN array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'MENU_ORDER' => array(
|
||||
'value' => 'menu_order',
|
||||
'description' => __( 'Order by the menu order value', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return enumeration values.
|
||||
*
|
||||
* @array
|
||||
*/
|
||||
protected static function values() {
|
||||
return self::post_type_values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers type
|
||||
*/
|
||||
public static function register() {
|
||||
$name = static::$name;
|
||||
register_graphql_enum_type(
|
||||
$name . 'OrderByEnum',
|
||||
array(
|
||||
'description' => sprintf(
|
||||
/* translators: ordering enumeration description */
|
||||
__( 'Fields to order the %s connection by', 'wp-graphql-woocommerce' ),
|
||||
$name
|
||||
),
|
||||
'values' => apply_filters( "{$name}_orderby_enum_values", static::values() ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* WPEnum Type - ProductsOrderbyEnum
|
||||
*
|
||||
* @package \WPGraphQL\Extensions\WooCommerce\Type\WPEnum
|
||||
* @since 0.2.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Type\WPEnum;
|
||||
|
||||
/**
|
||||
* Class Products_Orderby_Enum
|
||||
*/
|
||||
class Products_Orderby_Enum extends Post_Type_Orderby_Enum {
|
||||
/**
|
||||
* Holds ordering enumeration base name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $name = 'Products';
|
||||
|
||||
/**
|
||||
* Return enumeration values related to the "product" post-type.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values() {
|
||||
return array_merge(
|
||||
self::post_type_values(),
|
||||
array(
|
||||
'PRICE' => array(
|
||||
'value' => '_price',
|
||||
'description' => __( 'Order by product\'s current price', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'REGULAR_PRICE' => array(
|
||||
'value' => '_regular_price',
|
||||
'description' => __( 'Order by product\'s regular price', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'SALE_PRICE' => array(
|
||||
'value' => '_sale_price',
|
||||
'description' => __( 'Order by product\'s sale price', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'REVIEW_COUNT' => array(
|
||||
'value' => '_wc_rating_count',
|
||||
'description' => __( 'Order by number of reviews on product', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'RATING' => array(
|
||||
'value' => '_wc_average_rating',
|
||||
'description' => __( 'Order by product average rating', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'ON_SALE_FROM' => array(
|
||||
'value' => '_sale_price_dates_from',
|
||||
'description' => __( 'Order by date product sale starts', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'ON_SALE_TO' => array(
|
||||
'value' => '_sale_price_dates_to',
|
||||
'description' => __( 'Order by date product sale ends', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'TOTAL_SALES' => array(
|
||||
'value' => 'total_sales',
|
||||
'description' => __( 'Order by total sales of products sold', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WPEnum Type - WCConnectionOrderbyInput
|
||||
*
|
||||
* @package \WPGraphQL\Extensions\WooCommerce\Type\WPEnum
|
||||
* @since 0.0.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Type\WPEnum;
|
||||
|
||||
/**
|
||||
* Class WC_Connection_Orderby_Enum
|
||||
*/
|
||||
class WC_Connection_Orderby_Enum {
|
||||
/**
|
||||
* Registers type
|
||||
*/
|
||||
public static function register() {
|
||||
register_graphql_enum_type(
|
||||
'WCConnectionOrderbyEnum',
|
||||
array(
|
||||
'description' => __( 'Field to order the connection by', 'wp-graphql-woocommerce' ),
|
||||
'values' => array(
|
||||
'SLUG' => array(
|
||||
'value' => 'post_name',
|
||||
'description' => __( 'Order by slug', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'MODIFIED' => array(
|
||||
'value' => 'post_modified',
|
||||
'description' => __( 'Order by last modified date', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'DATE' => array(
|
||||
'value' => 'post_date',
|
||||
'description' => __( 'Order by publish date', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'PARENT' => array(
|
||||
'value' => 'post_parent',
|
||||
'description' => __( 'Order by parent ID', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'IN' => array(
|
||||
'value' => 'post__in',
|
||||
'description' => __( 'Preserve the ID order given in the IN array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'NAME_IN' => array(
|
||||
'value' => 'post_name__in',
|
||||
'description' => __( 'Preserve slug order given in the NAME_IN array', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'MENU_ORDER' => array(
|
||||
'value' => 'menu_order',
|
||||
'description' => __( 'Order by the menu order value', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'PRICE' => array(
|
||||
'value' => '_price',
|
||||
'description' => __( 'Order by the menu order value', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'REGULAR_PRICE' => array(
|
||||
'value' => '_regular_price',
|
||||
'description' => __( 'Order by the menu order value', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
'SALE_PRICE' => array(
|
||||
'value' => '_sale_price',
|
||||
'description' => __( 'Order by the menu order value', 'wp-graphql-woocommerce' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* WPInputObjectTypes:
|
||||
* - PostTypeOrderbyInput
|
||||
* - ProductsOrderbyInput
|
||||
* - OrdersOrderbyInput
|
||||
*
|
||||
* @package \WPGraphQL\Extensions\WooCommerce\Type\WPInputObject
|
||||
* @since 0.2.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Type\WPInputObject;
|
||||
|
||||
/**
|
||||
* Class Orderby_Inputs
|
||||
*/
|
||||
class Orderby_Inputs {
|
||||
|
||||
/**
|
||||
* Registers Orderby WPInputObject type to schema.
|
||||
*
|
||||
* @param string $base_name Base name of WPInputObject being registered.
|
||||
*/
|
||||
public static function register_orderby_input( $base_name ) {
|
||||
register_graphql_input_type(
|
||||
$base_name . 'OrderbyInput',
|
||||
array(
|
||||
'description' => __( 'Options for ordering the connection', 'wp-graphql-woocommerce' ),
|
||||
'fields' => array(
|
||||
'field' => array(
|
||||
'type' => array( 'non_null' => $base_name . 'OrderbyEnum' ),
|
||||
),
|
||||
'order' => array(
|
||||
'type' => 'OrderEnum',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers type
|
||||
*/
|
||||
public static function register() {
|
||||
$input_types = array(
|
||||
'PostType',
|
||||
'Products',
|
||||
'Orders',
|
||||
);
|
||||
|
||||
foreach ( $input_types as $name ) {
|
||||
self::register_orderby_input( $name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WPInputObjectType - WCConnectionOrderbyInput
|
||||
*
|
||||
* @package \WPGraphQL\Extensions\WooCommerce\Type\WPInputObject
|
||||
* @since 0.0.2
|
||||
*/
|
||||
|
||||
namespace WPGraphQL\Extensions\WooCommerce\Type\WPInputObject;
|
||||
|
||||
/**
|
||||
* Class WC_Connection_Orderby_Input
|
||||
*/
|
||||
class WC_Connection_Orderby_Input {
|
||||
/**
|
||||
* Registers type
|
||||
*/
|
||||
public static function register() {
|
||||
register_graphql_input_type(
|
||||
'WCConnectionOrderbyInput',
|
||||
array(
|
||||
'description' => __( 'Options for ordering the connection', 'wp-graphql-woocommerce' ),
|
||||
'fields' => array(
|
||||
'field' => array(
|
||||
'type' => array( 'non_null' => 'WCConnectionOrderbyEnum' ),
|
||||
),
|
||||
'order' => array(
|
||||
'type' => 'OrderEnum',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ class ProductQueriesTest extends \Codeception\TestCase\WPTestCase {
|
||||
$typeNotIn: [ProductTypesEnum],
|
||||
$featured: Boolean,
|
||||
$maxPrice: Float,
|
||||
$orderby: [WCConnectionOrderbyInput]
|
||||
$orderby: [ProductsOrderbyInput]
|
||||
$taxonomyFilter: [ProductTaxonomyFilterRelationInput]
|
||||
){
|
||||
products( where: {
|
||||
|
||||
+5
-4
@@ -19,10 +19,10 @@ return array(
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\Shipping_Methods' => $baseDir . '/includes/connection/class-shipping-methods.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\Tax_Rates' => $baseDir . '/includes/connection/class-tax-rates.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\Variation_Attributes' => $baseDir . '/includes/connection/class-variation-attributes.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\WC_Connection' => $baseDir . '/includes/connection/class-wc-connection.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\WC_Terms' => $baseDir . '/includes/connection/class-wc-terms.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Core_Schema_Filters' => $baseDir . '/includes/class-core-schema-filters.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Cart_Item_Connection_Resolver' => $baseDir . '/includes/data/connection/class-cart-item-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Common_CPT_Input_Sanitize_Functions' => $baseDir . '/includes/data/connection/trait-common-cpt-args-processing.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Coupon_Connection_Resolver' => $baseDir . '/includes/data/connection/class-coupon-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Customer_Connection_Resolver' => $baseDir . '/includes/data/connection/class-customer-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Order_Connection_Resolver' => $baseDir . '/includes/data/connection/class-order-connection-resolver.php',
|
||||
@@ -35,7 +35,6 @@ return array(
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Shipping_Method_Connection_Resolver' => $baseDir . '/includes/data/connection/class-shipping-method-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Tax_Rate_Connection_Resolver' => $baseDir . '/includes/data/connection/class-tax-rate-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Variation_Attribute_Connection_Resolver' => $baseDir . '/includes/data/connection/class-variation-attribute-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\WC_Connection_Resolver' => $baseDir . '/includes/data/connection/trait-wc-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\WC_Terms_Connection_Resolver' => $baseDir . '/includes/data/connection/class-wc-terms-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Factory' => $baseDir . '/includes/data/class-factory.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Loader\\WC_Customer_Loader' => $baseDir . '/includes/data/loader/class-wc-customer-loader.php',
|
||||
@@ -77,27 +76,29 @@ return array(
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Discount_Type' => $baseDir . '/includes/type/enum/class-discount-type.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Manage_Stock' => $baseDir . '/includes/type/enum/class-manage-stock.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Order_Status' => $baseDir . '/includes/type/enum/class-order-status.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Orders_Orderby_Enum' => $baseDir . '/includes/type/enum/class-orders-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Post_Type_Orderby_Enum' => $baseDir . '/includes/type/enum/class-post-type-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Pricing_Field_Format' => $baseDir . '/includes/type/enum/class-pricing-field-format.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Product_Taxonomy' => $baseDir . '/includes/type/enum/class-product-taxonomy.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Product_Types' => $baseDir . '/includes/type/enum/class-product-types.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Products_Orderby_Enum' => $baseDir . '/includes/type/enum/class-products-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Stock_Status' => $baseDir . '/includes/type/enum/class-stock-status.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Tax_Class' => $baseDir . '/includes/type/enum/class-tax-class.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Tax_Rate_Connection_Orderby_Enum' => $baseDir . '/includes/type/enum/class-tax-rate-connection-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Tax_Status' => $baseDir . '/includes/type/enum/class-tax-status.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Taxonomy_Operator' => $baseDir . '/includes/type/enum/class-taxonomy-operator.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\WC_Connection_Orderby_Enum' => $baseDir . '/includes/type/enum/class-wc-connection-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Cart_Item_Quantity_Input' => $baseDir . '/includes/type/input/class-cart-item-quantity-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Create_Account_Input' => $baseDir . '/includes/type/input/class-create-account-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Customer_Address_Input' => $baseDir . '/includes/type/input/class-customer-address-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Fee_Line_Input' => $baseDir . '/includes/type/input/class-fee-line-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Line_Item_Input' => $baseDir . '/includes/type/input/class-line-item-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Meta_Data_Input' => $baseDir . '/includes/type/input/class-meta-data-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Orderby_Inputs' => $baseDir . '/includes/type/input/class-orderby-inputs.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Product_Attribute_Input' => $baseDir . '/includes/type/input/class-product-attribute-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Product_Taxonomy_Filter_Input' => $baseDir . '/includes/type/input/class-product-taxonomy-filter-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Product_Taxonomy_Filter_Relation_Input' => $baseDir . '/includes/type/input/class-product-taxonomy-filter-relation-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Shipping_Line_Input' => $baseDir . '/includes/type/input/class-shipping-line-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Tax_Rate_Connection_Orderby_Input' => $baseDir . '/includes/type/input/class-tax-rate-connection-orderby-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\WC_Connection_Orderby_Input' => $baseDir . '/includes/type/input/class-wc-connection-orderby-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPObject\\Cart_Type' => $baseDir . '/includes/type/object/class-cart-type.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPObject\\Coupon_Type' => $baseDir . '/includes/type/object/class-coupon-type.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPObject\\Customer_Address_Type' => $baseDir . '/includes/type/object/class-customer-address-type.php',
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
// autoload_files.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'914b07b8cf678ed0b81bfdb5d23b4f2b' => $baseDir . '/includes/connection/common-post-type-args.php',
|
||||
);
|
||||
Vendored
+18
@@ -47,6 +47,24 @@ class ComposerAutoloaderInit47658c4b7d8904b82de7ca7f79505649
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit47658c4b7d8904b82de7ca7f79505649::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire47658c4b7d8904b82de7ca7f79505649($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire47658c4b7d8904b82de7ca7f79505649($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+9
-4
@@ -6,6 +6,10 @@ namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit47658c4b7d8904b82de7ca7f79505649
|
||||
{
|
||||
public static $files = array (
|
||||
'914b07b8cf678ed0b81bfdb5d23b4f2b' => __DIR__ . '/../..' . '/includes/connection/common-post-type-args.php',
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'W' =>
|
||||
array (
|
||||
@@ -34,10 +38,10 @@ class ComposerStaticInit47658c4b7d8904b82de7ca7f79505649
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\Shipping_Methods' => __DIR__ . '/../..' . '/includes/connection/class-shipping-methods.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\Tax_Rates' => __DIR__ . '/../..' . '/includes/connection/class-tax-rates.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\Variation_Attributes' => __DIR__ . '/../..' . '/includes/connection/class-variation-attributes.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\WC_Connection' => __DIR__ . '/../..' . '/includes/connection/class-wc-connection.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Connection\\WC_Terms' => __DIR__ . '/../..' . '/includes/connection/class-wc-terms.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Core_Schema_Filters' => __DIR__ . '/../..' . '/includes/class-core-schema-filters.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Cart_Item_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-cart-item-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Common_CPT_Input_Sanitize_Functions' => __DIR__ . '/../..' . '/includes/data/connection/trait-common-cpt-args-processing.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Coupon_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-coupon-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Customer_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-customer-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Order_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-order-connection-resolver.php',
|
||||
@@ -50,7 +54,6 @@ class ComposerStaticInit47658c4b7d8904b82de7ca7f79505649
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Shipping_Method_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-shipping-method-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Tax_Rate_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-tax-rate-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\Variation_Attribute_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-variation-attribute-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\WC_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/trait-wc-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Connection\\WC_Terms_Connection_Resolver' => __DIR__ . '/../..' . '/includes/data/connection/class-wc-terms-connection-resolver.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Factory' => __DIR__ . '/../..' . '/includes/data/class-factory.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Data\\Loader\\WC_Customer_Loader' => __DIR__ . '/../..' . '/includes/data/loader/class-wc-customer-loader.php',
|
||||
@@ -92,27 +95,29 @@ class ComposerStaticInit47658c4b7d8904b82de7ca7f79505649
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Discount_Type' => __DIR__ . '/../..' . '/includes/type/enum/class-discount-type.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Manage_Stock' => __DIR__ . '/../..' . '/includes/type/enum/class-manage-stock.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Order_Status' => __DIR__ . '/../..' . '/includes/type/enum/class-order-status.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Orders_Orderby_Enum' => __DIR__ . '/../..' . '/includes/type/enum/class-orders-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Post_Type_Orderby_Enum' => __DIR__ . '/../..' . '/includes/type/enum/class-post-type-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Pricing_Field_Format' => __DIR__ . '/../..' . '/includes/type/enum/class-pricing-field-format.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Product_Taxonomy' => __DIR__ . '/../..' . '/includes/type/enum/class-product-taxonomy.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Product_Types' => __DIR__ . '/../..' . '/includes/type/enum/class-product-types.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Products_Orderby_Enum' => __DIR__ . '/../..' . '/includes/type/enum/class-products-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Stock_Status' => __DIR__ . '/../..' . '/includes/type/enum/class-stock-status.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Tax_Class' => __DIR__ . '/../..' . '/includes/type/enum/class-tax-class.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Tax_Rate_Connection_Orderby_Enum' => __DIR__ . '/../..' . '/includes/type/enum/class-tax-rate-connection-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Tax_Status' => __DIR__ . '/../..' . '/includes/type/enum/class-tax-status.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\Taxonomy_Operator' => __DIR__ . '/../..' . '/includes/type/enum/class-taxonomy-operator.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPEnum\\WC_Connection_Orderby_Enum' => __DIR__ . '/../..' . '/includes/type/enum/class-wc-connection-orderby-enum.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Cart_Item_Quantity_Input' => __DIR__ . '/../..' . '/includes/type/input/class-cart-item-quantity-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Create_Account_Input' => __DIR__ . '/../..' . '/includes/type/input/class-create-account-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Customer_Address_Input' => __DIR__ . '/../..' . '/includes/type/input/class-customer-address-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Fee_Line_Input' => __DIR__ . '/../..' . '/includes/type/input/class-fee-line-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Line_Item_Input' => __DIR__ . '/../..' . '/includes/type/input/class-line-item-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Meta_Data_Input' => __DIR__ . '/../..' . '/includes/type/input/class-meta-data-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Orderby_Inputs' => __DIR__ . '/../..' . '/includes/type/input/class-orderby-inputs.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Product_Attribute_Input' => __DIR__ . '/../..' . '/includes/type/input/class-product-attribute-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Product_Taxonomy_Filter_Input' => __DIR__ . '/../..' . '/includes/type/input/class-product-taxonomy-filter-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Product_Taxonomy_Filter_Relation_Input' => __DIR__ . '/../..' . '/includes/type/input/class-product-taxonomy-filter-relation-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Shipping_Line_Input' => __DIR__ . '/../..' . '/includes/type/input/class-shipping-line-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\Tax_Rate_Connection_Orderby_Input' => __DIR__ . '/../..' . '/includes/type/input/class-tax-rate-connection-orderby-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPInputObject\\WC_Connection_Orderby_Input' => __DIR__ . '/../..' . '/includes/type/input/class-wc-connection-orderby-input.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPObject\\Cart_Type' => __DIR__ . '/../..' . '/includes/type/object/class-cart-type.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPObject\\Coupon_Type' => __DIR__ . '/../..' . '/includes/type/object/class-coupon-type.php',
|
||||
'WPGraphQL\\Extensions\\WooCommerce\\Type\\WPObject\\Customer_Address_Type' => __DIR__ . '/../..' . '/includes/type/object/class-customer-address-type.php',
|
||||
|
||||
Reference in New Issue
Block a user