Skip to content

Commit ba14f1c

Browse files
creative-andrewAndres Akidunot89
authored
fix: product variation raw price not visible for public users (#671)
* fix: product variation raw price not visible for public users * fixup! fix: product variation raw price not visible for public users * fixup! fixup! fix: product variation raw price not visible for public users * chore: WPCS compliance met Co-authored-by: Andres A <[email protected]> Co-authored-by: Geoff Taylor <[email protected]>
1 parent ddb5195 commit ba14f1c

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

includes/connection/class-coupons.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ public static function map_input_fields_to_wp_query( $query_args, $where_args, $
125125
: $ids;
126126
}
127127

128-
129128
/**
130129
* Filter the input fields
131130
* This allows plugins/themes to hook in and alter what $args should be allowed to be passed

includes/model/class-product-variation.php

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -148,28 +148,16 @@ protected function init() {
148148
'type' => function() {
149149
return ! empty( $this->wc_data->get_type() ) ? $this->wc_data->get_type() : null;
150150
},
151+
'priceRaw' => function() {
152+
return ! empty( $this->wc_data->get_price() ) ? $this->wc_data->get_price() : null;
153+
},
154+
'regularPriceRaw' => function() {
155+
return ! empty( $this->wc_data->get_regular_price() ) ? $this->wc_data->get_regular_price() : null;
156+
},
151157

152-
/**
153-
* Editor/Shop Manager only fields
154-
*/
155-
'priceRaw' => [
156-
'callback' => function() {
157-
return ! empty( $this->wc_data->get_price() ) ? $this->wc_data->get_price() : null;
158-
},
159-
'capability' => $this->post_type_object->cap->edit_posts,
160-
],
161-
'regularPriceRaw' => [
162-
'callback' => function() {
163-
return ! empty( $this->wc_data->get_regular_price() ) ? $this->wc_data->get_regular_price() : null;
164-
},
165-
'capability' => $this->post_type_object->cap->edit_posts,
166-
],
167-
'salePriceRaw' => [
168-
'callback' => function() {
169-
return ! empty( $this->wc_data->get_sale_price() ) ? $this->wc_data->get_sale_price() : null;
170-
},
171-
'capability' => $this->post_type_object->cap->edit_posts,
172-
],
158+
'salePriceRaw' => function() {
159+
return ! empty( $this->wc_data->get_sale_price() ) ? $this->wc_data->get_sale_price() : null;
160+
},
173161

174162
/**
175163
* Connection resolvers fields

0 commit comments

Comments
 (0)