WPC Composite Products for WooCommerce By WPClever
- in file wp-content\plugins\wpc-composite-products\includes\class-wooco.php add next code (2 places):
if (class_exists('WOOCS') AND $cart_item['wooco_price'] > 0) { global $WOOCS; $cart_item['wooco_price'] = $WOOCS->woocs_exchange_value(floatval($cart_item['wooco_price'])); }
- into file functions.php of the current WordPress theme add next code:
add_filter('wooco_product_price', function ($price_display, $product, $qty, $price) { if (class_exists('WOOCS') AND $price_display > 0) { global $WOOCS; $price_display = $WOOCS->woocs_exchange_value(floatval($price_display)); } return $price_display; }, 10, 4); add_filter('wooco_product_regular_price', function ($org_price, $product, $qty, $price) { if (class_exists('WOOCS') AND $org_price > 0) { global $WOOCS; $org_price = $WOOCS->woocs_exchange_value(floatval($org_price)); } return $org_price; }, 10, 4); add_filter('wooco_product_new_price', function ($new_price, $product, $qty, $price) { if (class_exists('WOOCS') AND $new_price > 0) { global $WOOCS; $new_price = $WOOCS->woocs_exchange_value(floatval($new_price)); } return $new_price; }, 10, 4); add_filter('wooco_product_price_html', function ($price_html, $product, $qty, $price) { if (class_exists('WOOCS') AND $price > 0) { global $WOOCS; $price_html = wc_price($WOOCS->woocs_exchange_value(floatval($price))); //$price_html = wc_format_sale_price( wc_get_price_to_display( $product, [ ‘price’ => $price_ori ] ), $price_display); } return $price_html; }, 10, 4);
This edit is inside another plugin's file, so a plugin update will undo it. Write the change down, and re-apply it after every update of that plugin — or ask its authors to include the fix on their side, which is the only version that survives. If the change is inside FOX itself, tell us: a fix that has to be re-applied by hand is a bug on our side, not a solution.