diff --git a/helloextend-protection/helloextend-protection.php b/helloextend-protection/helloextend-protection.php index 7743efd..6234d2d 100644 --- a/helloextend-protection/helloextend-protection.php +++ b/helloextend-protection/helloextend-protection.php @@ -16,7 +16,7 @@ * Plugin Name: Extend Protection For WooCommerce * Plugin URI: https://docs.extend.com/docs/extend-protection-plugin-for-woocommerce * Description: Extend Protection for Woocommerce. Allows WooCommerce merchants to offer product and shipping protection to their customers. - * Version: 1.2.0 + * Version: 1.2.4 * Author: Extend, Inc. * Author URI: https://extend.com/ * License: GPL-2.0+ @@ -44,7 +44,7 @@ * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ -define('HELLOEXTEND_PROTECTION_VERSION', '1.1.0'); +define('HELLOEXTEND_PROTECTION_VERSION', '1.2.4'); define('HELLOEXTEND_PRODUCT_PROTECTION_SKU', 'helloextend-product-protection'); define('HELLOEXTEND_SHIPPING_PROTECTION_SKU', 'helloextend-shipping-protection'); diff --git a/helloextend-protection/includes/class-helloextend-global.php b/helloextend-protection/includes/class-helloextend-global.php index ab82646..e3953a2 100644 --- a/helloextend-protection/includes/class-helloextend-global.php +++ b/helloextend-protection/includes/class-helloextend-global.php @@ -93,7 +93,7 @@ public function hooks() add_action('woocommerce_checkout_create_order_line_item', [$this, 'order_item_meta'], 10, 3); // update price for warranty items - add_action('woocommerce_before_calculate_totals', [$this, 'update_price']); + add_action('woocommerce_before_calculate_totals', [$this, 'update_price'], 99999); // Initialize global ExtendWooCommerce add_action('wp_head', [$this, 'helloextend_init_global']); @@ -283,16 +283,18 @@ public static function helloextend_add_to_cart() // update_price($cart_object) // @param $cart_object : WC_Cart, represents current cart object - public function update_price($cart_object) + public function update_price($cart) { - $cart_items = $cart_object->cart_contents; + if (is_admin() && !defined('DOING_AJAX')) return; - if (!empty($cart_items)) { + foreach ($cart->get_cart() as $cart_item_key => $cart_item) { + if (!empty($cart_item['extendData']) && (!empty($cart_item['extendData']['price']) || $cart_item['extendData']['price'] == (int) 0)) { - foreach ($cart_items as $key => $value) { - if (isset($value['extendData']) && !empty($value['extendData'])) { - $value['data']->set_price(round($value['extendData']['price'] / 100, 2)); - } + $price = round(floatval($cart_item['extendData']['price']) / 100, 2); + + $cart_item['data']->set_price($price); + $cart_item['data']->set_regular_price($price); + $cart_item['data']->set_sale_price(''); } } } diff --git a/helloextend-protection/includes/class-helloextend-protection-orders.php b/helloextend-protection/includes/class-helloextend-protection-orders.php index 4f742fb..be7cc06 100644 --- a/helloextend-protection/includes/class-helloextend-protection-orders.php +++ b/helloextend-protection/includes/class-helloextend-protection-orders.php @@ -245,8 +245,8 @@ public function helloextend_get_plans_and_products($order, $fulfill_now = false) 'id' => $product->get_id(), 'title' => $product->get_name(), 'category' => $first_category, - 'listPrice' => $this->get_price_in_cents($product->get_regular_price() * 100), - 'purchasePrice' => $this->get_price_in_cents($product->get_price() * 100), + 'listPrice' => $this->get_price_in_cents($product->get_regular_price()), + 'purchasePrice' => $this->get_price_in_cents($product->get_price()), 'purchaseDate' => $order->get_data()['date_created']->getTimestamp() * 1000, 'imageUrl' => $image_url ), diff --git a/helloextend-protection/readme.txt b/helloextend-protection/readme.txt index e1bb554..e181aec 100644 --- a/helloextend-protection/readme.txt +++ b/helloextend-protection/readme.txt @@ -5,7 +5,7 @@ Contributors: santiagoenciso33, jmbextend, alexsmithext, helloextend Tags: extend, protection, tracking Requires at least: 4.0 Tested up to: 6.8 -Stable tag: 1.2.0 +Stable tag: 1.2.4 Requires PHP: 7.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -79,6 +79,13 @@ For more information on our terms of service and privacy policy, visit the links == Changelog == += 1.2.4 2026-05-08 = +* Fix - Increased priority for warranty price hook so that plan prices are properly set in more scenarios. +* Fix - Fixed a bug where product prices were incorrectly set when orders were sent to Extend. + += 1.2.3 2026-03-25 = +* Feature - Added support for cart offers in WooCommerce side cart + = 1.2.0 2025-09-09 = * Feature - Customers now have the option to purchase a protection plan after their initial purchase. Contact Extend to learn more. * Fix - Any protection plans on an order will be cancelled when the line items or entire order is refunded or cancelled