Skip to content

Commit c1719c1

Browse files
committed
add min/max price to variable meta data
1 parent e10b552 commit c1719c1

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

includes/API/Products.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,31 @@ public function product_response( WP_REST_Response $response, WC_Data $product,
106106
Logger::log( "Product ID {$product->get_id()} has a response size of {$response_size} bytes, exceeding the limit of {$max_response_size} bytes." );
107107
}
108108

109+
/**
110+
* If product is variable, add the max and min prices and add them to the meta data
111+
* @TODO - only need to update if there is a change
112+
*/
113+
if ( $product->is_type( 'variable' ) ) {
114+
$product->update_meta_data( '_woocommerce_pos_variable_prices', wp_json_encode(
115+
array(
116+
'price' => array(
117+
'min' => $product->get_variation_price(),
118+
'max' => $product->get_variation_price( 'max' ),
119+
),
120+
'regular_price' => array(
121+
'min' => $product->get_variation_regular_price(),
122+
'max' => $product->get_variation_regular_price( 'max' ),
123+
),
124+
'sale_price' => array(
125+
'min' => $product->get_variation_sale_price(),
126+
'max' => $product->get_variation_sale_price( 'max' ),
127+
),
128+
)
129+
) );
130+
$product->save_meta_data();
131+
$data['meta_data'] = $product->get_meta_data();
132+
}
133+
109134
/**
110135
* Reset the new response data
111136
*/

includes/Init.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ public function rest_pre_serve_request( bool $served, WP_HTTP_Response $result,
133133
/**
134134
* Allow HEAD checks for WP API Link URL and server uptime
135135
* Fires once the requested HTTP headers for caching, content type, etc. have been sent.
136+
*
137+
* FIXME: Why is Link header not exposed sometimes on my development machine?
136138
*/
137139
public function send_headers(): void {
138140
// some server convert HEAD to GET method, so use this query param instead

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wcpos/woocommerce-pos",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"description": "A simple front-end for taking WooCommerce orders at the Point of Sale.",
55
"main": "index.js",
66
"workspaces": {

readme.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: kilbot
33
Tags: cart, e-commerce, ecommerce, inventory, point-of-sale, pos, sales, sell, shop, shopify, store, vend, woocommerce, wordpress-ecommerce
44
Requires at least: 5.6 & WooCommerce 5.3
55
Tested up to: 6.2
6-
Stable tag: 1.0.2
6+
Stable tag: 1.1.0
77
License: GPL-3.0
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -63,6 +63,11 @@ There is more information on our website at [https://wcpos.com](https://wcpos.co
6363

6464
== Changelog ==
6565

66+
= 1.1.0 - 2023/05/19 =
67+
* Fix: disable Lite Speed Cache for POS page
68+
* Fix: add id audit for product categories and tags
69+
* Fix: add min/max price to variable meta data
70+
6671
= 1.0.2 - 2023/05/05 =
6772
* No change, just messed up the release to WordPress.org.
6873

woocommerce-pos.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WooCommerce POS
44
* Plugin URI: https://wordpress.org/plugins/woocommerce-pos/
55
* Description: A simple front-end for taking WooCommerce orders at the Point of Sale. Requires <a href="http://wordpress.org/plugins/woocommerce/">WooCommerce</a>.
6-
* Version: 1.0.2
6+
* Version: 1.1.0
77
* Author: kilbot
88
* Author URI: http://wcpos.com
99
* Text Domain: woocommerce-pos
@@ -23,7 +23,7 @@
2323
use Dotenv\Dotenv;
2424

2525
// Define plugin constants.
26-
const VERSION = '1.0.2';
26+
const VERSION = '1.1.0';
2727
const PLUGIN_NAME = 'woocommerce-pos';
2828
const SHORT_NAME = 'wcpos';
2929
\define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php'

0 commit comments

Comments
 (0)