-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Fix Product Variation Shipping Class #895
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -413,7 +413,7 @@ protected function init() { | |
return ! empty( $this->wc_data->get_height() ) ? $this->wc_data->get_height() : null; | ||
}, | ||
'shippingClassId' => function () { | ||
return ! empty( $this->wc_data->get_image_id() ) ? $this->wc_data->get_shipping_class_id() : null; | ||
return ! empty( $this->wc_data->get_shipping_class_id() ) ? $this->wc_data->get_shipping_class_id() : null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch |
||
}, | ||
'shippingRequired' => function () { | ||
return $this->wc_data->needs_shipping(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,8 +243,12 @@ public static function get_fields() { | |
'type' => 'String', | ||
'description' => __( 'Product variation purchase_note', 'wp-graphql-woocommerce' ), | ||
], | ||
'shippingClassId' => [ | ||
'type' => 'Int', | ||
'description' => __( 'Product variation shipping class ID', 'wp-graphql-woocommerce' ), | ||
], | ||
'shippingClass' => [ | ||
'type' => 'String', | ||
'type' => 'ShippingClass', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought this is the type: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That means this needs to be provided with a resolver that resolves to the 'resolve' => static function ( $source, array $args, $context ) {
$id = $source->shipping_class_id;
if ( $id ) {
return $context->get_loader( "term" )->load_deferred( $id );
}
return null;
}, |
||
'description' => __( 'Product variation shipping class', 'wp-graphql-woocommerce' ), | ||
], | ||
'catalogVisibility' => [ | ||
|
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.
Is this necessary, why can't we continue to used the snake case
shipping_class_id