diff --git a/includes/API/Products.php b/includes/API/Products.php index 7a88521..b0d2975 100644 --- a/includes/API/Products.php +++ b/includes/API/Products.php @@ -106,6 +106,31 @@ public function product_response( WP_REST_Response $response, WC_Data $product, Logger::log( "Product ID {$product->get_id()} has a response size of {$response_size} bytes, exceeding the limit of {$max_response_size} bytes." ); } + /** + * If product is variable, add the max and min prices and add them to the meta data + * @TODO - only need to update if there is a change + */ + if ( $product->is_type( 'variable' ) ) { + $product->update_meta_data( '_woocommerce_pos_variable_prices', wp_json_encode( + array( + 'price' => array( + 'min' => $product->get_variation_price(), + 'max' => $product->get_variation_price( 'max' ), + ), + 'regular_price' => array( + 'min' => $product->get_variation_regular_price(), + 'max' => $product->get_variation_regular_price( 'max' ), + ), + 'sale_price' => array( + 'min' => $product->get_variation_sale_price(), + 'max' => $product->get_variation_sale_price( 'max' ), + ), + ) + ) ); + $product->save_meta_data(); + $data['meta_data'] = $product->get_meta_data(); + } + /** * Reset the new response data */ diff --git a/includes/Init.php b/includes/Init.php index 032e3f3..b231648 100644 --- a/includes/Init.php +++ b/includes/Init.php @@ -133,6 +133,8 @@ public function rest_pre_serve_request( bool $served, WP_HTTP_Response $result, /** * Allow HEAD checks for WP API Link URL and server uptime * Fires once the requested HTTP headers for caching, content type, etc. have been sent. + * + * FIXME: Why is Link header not exposed sometimes on my development machine? */ public function send_headers(): void { // some server convert HEAD to GET method, so use this query param instead diff --git a/package.json b/package.json index 8aca562..e52ca44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wcpos/woocommerce-pos", - "version": "1.0.2", + "version": "1.1.0", "description": "A simple front-end for taking WooCommerce orders at the Point of Sale.", "main": "index.js", "workspaces": { diff --git a/readme.txt b/readme.txt index 2871879..f1efd73 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: kilbot Tags: cart, e-commerce, ecommerce, inventory, point-of-sale, pos, sales, sell, shop, shopify, store, vend, woocommerce, wordpress-ecommerce Requires at least: 5.6 & WooCommerce 5.3 Tested up to: 6.2 -Stable tag: 1.0.2 +Stable tag: 1.1.0 License: GPL-3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -63,6 +63,11 @@ There is more information on our website at [https://wcpos.com](https://wcpos.co == Changelog == += 1.1.0 - 2023/05/19 = +* Fix: disable Lite Speed Cache for POS page +* Fix: add id audit for product categories and tags +* Fix: add min/max price to variable meta data + = 1.0.2 - 2023/05/05 = * No change, just messed up the release to WordPress.org. diff --git a/woocommerce-pos.php b/woocommerce-pos.php index 70d1789..4019462 100644 --- a/woocommerce-pos.php +++ b/woocommerce-pos.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce POS * Plugin URI: https://wordpress.org/plugins/woocommerce-pos/ * Description: A simple front-end for taking WooCommerce orders at the Point of Sale. Requires WooCommerce. - * Version: 1.0.2 + * Version: 1.1.0 * Author: kilbot * Author URI: http://wcpos.com * Text Domain: woocommerce-pos @@ -23,7 +23,7 @@ use Dotenv\Dotenv; // Define plugin constants. -const VERSION = '1.0.2'; +const VERSION = '1.1.0'; const PLUGIN_NAME = 'woocommerce-pos'; const SHORT_NAME = 'wcpos'; \define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php'