Plugin Directory

Changeset 3346212


Ignore:
Timestamp:
08/18/2025 08:10:35 AM (8 months ago)
Author:
buildecomteam
Message:

1.1.2 grouped product.. release

Location:
buildecom/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • buildecom/trunk/api.php

    r3345590 r3346212  
    266266           
    267267        }
     268    }
     269
     270    if ($product->is_type('grouped')) {
     271        $children_ids = $product->get_children();
     272        $min_price    = null;
     273        $max_price    = null;
     274
     275        foreach ($children_ids as $child_id) {
     276            $child = wc_get_product($child_id);
     277            if (!$child) {
     278                continue;
     279            }
     280
     281            if ($child->is_type('variable')) {
     282                $child_min = $child->get_variation_price();         // min
     283                $child_max = $child->get_variation_price('max');    // max
     284            } else {
     285                $child_min = $child->get_price();
     286                $child_max = $child_min;
     287            }
     288
     289            if ($child_min === '' && $child_max === '') {
     290                continue;
     291            }
     292
     293            if ($child_min !== '') {
     294                $child_min = wc_get_price_to_display($child, ['price' => (float) $child_min]);
     295            }
     296            if ($child_max !== '') {
     297                $child_max = wc_get_price_to_display($child, ['price' => (float) $child_max]);
     298            }
     299
     300            if ($child_min !== '' && ($min_price === null || $child_min < $min_price)) {
     301                $min_price = $child_min;
     302            }
     303            if ($child_max !== '' && ($max_price === null || $child_max > $max_price)) {
     304                $max_price = $child_max;
     305            }
     306        }
     307
     308        $response->data['min_price'] = ($min_price !== null) ? strval($min_price) : '0';
     309        $response->data['max_price'] = ($max_price !== null) ? strval($max_price) : '0';
     310        $response->data['price']     = $response->data['min_price'];
    268311    }
    269312
  • buildecom/trunk/buildecom.php

    r3346129 r3346212  
    88 * Plugin URI: https://buildecom.app/wp-plugin/
    99 * Description: The official WordPress plugin for BuildEcom. Build eCommerce mobile application through woocommerce and wordpress
    10  * Version: 1.1.1
     10 * Version: 1.1.2
    1111 * Author: BuildEcom
    1212 * Author URI: https://buildecom.app
  • buildecom/trunk/readme.txt

    r3346129 r3346212  
    44Requires at least: 4.7
    55Tested up to: 6.8
    6 Stable tag: 1.1.1
     6Stable tag: 1.1.2
    77License: GPL-2.0+
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.