-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/Product type #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions! Looking good! :)
* @access public | ||
*/ | ||
public static function resolve_product( $id ) { | ||
$product = new \WC_Product( $id ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kidunot89 Is the idea to create a product implementation for each type of products? WC_Product_Simple
, WC_Product_Variation
, etc?
If yes, can we do something to verify the WC_Product
and classes that extend WC_Abstract_Legacy_Product
?
That would allow WC_Product_Subscription_Variation
, WC_Product_Subscription
, and other product types to work without having to create their own product implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve_product
is only used in the root queries product
and productBy
, however I will add the ability to filter the resolver
of the Product
type, if this does not work for other Woo extensions
} | ||
if ( 'product_variation' === $query->query['post_type'] ) { | ||
foreach ( $query_info['items'] as &$item ) { | ||
$item = new \WC_Product_Variation( $item->ID ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be WC_Product_Simple
and others here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm waiting for the Model Layer
PR to be completed before optimizing base on queried fields. That way optimization can be done in Product
model and I can avoid having to refactor.
Your checklist for this pull request
Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.
🚨Please review the guidelines for contributing to this repository.
What does this implement/fix? Explain your changes.
Tests
ProductQueriesTest
Enum Types
BackorderEnum
CatalogVisibilityEnum
DiscountType
StockStatus
TaxStatus
Object Types
Product
ProductAttribute
Connections
Coupon
<->Products
-products
,excludedProducts
Coupon
<->ProductCategories
-productCategories
,excludedProductCategories
Product
<->Products
-upsell
,crossSell
,variations
Product
<->ProductCategories
-categories
Product
<->ProductTags
-tags
Product
<->ProductAttribute
-attributes
,defaultAttributes
Product
<->MediaItem
-galleryImages
Query example
Does this close any currently open issues?
…
Any relevant logs, error output, GraphiQL screenshots, etc?
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
Any other comments?
…
Where has this been tested?
Operating System: Ubuntu 18.04
WordPress Version: 5.1