Plugin Directory

Changeset 3449341


Ignore:
Timestamp:
01/29/2026 08:14:16 AM (2 months ago)
Author:
simplercheckout
Message:

Version 1.3.2

Location:
simpler-checkout
Files:
4 added
26 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simpler-checkout/tags/1.3.2/README.txt

    r3437538 r3449341  
    55Tested up to: 6.5
    66Requires PHP: 7.0
    7 Stable tag: 1.3.1
     7Stable tag: 1.3.2
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3535
    3636== Changelog ==
     37
     38== 1.3.2
     39Feat: handle grouped products
     40Fix: normalize option keys in product feed
     41Fix: handle stock status in product feed
     42Compat: Skroutz Lockers
    3743
    3844== 1.3.1
  • simpler-checkout/tags/1.3.2/includes/Models/Order.php

    r3272319 r3449341  
    3838     */
    3939    private $addons;
     40    /**
     41     * @var PickupPoint
     42     */
     43    private $pickupPoint;
    4044
    41     public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null)
     45    public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null, $pickupPoint = null)
    4246    {
    4347        $this->simpler_cart_id    = $simpler_cart_id;
     
    4953        $this->paymentMethod      = $paymentMethod;
    5054        $this->addons             = $addons;
     55        $this->pickupPoint        = $pickupPoint;
    5156    }
    5257
     
    7883            $items,
    7984            isset($json['payment']) ? PaymentMethod::from_json($json['payment']) : null,
    80             isset($json['addons']) ? $json['addons'] : null
     85            isset($json['addons']) ? $json['addons'] : null,
     86            isset($json['pickup_point']) ? PickupPoint::from_json($json['pickup_point']) : null
    8187        );
    8288    }
     
    121127        return $this->addons;
    122128    }
     129
     130    /**
     131     * @return PickupPoint
     132     */
     133    public function get_pickup_point()
     134    {
     135        return $this->pickupPoint;
     136    }
    123137}
  • simpler-checkout/tags/1.3.2/includes/Services/OrderService.php

    r3417395 r3449341  
    8787
    8888        \WC()->checkout()->set_data_from_cart($order);
    89         if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '10.3.0', '>=' ) ) {
     89        if (defined('WC_VERSION') && version_compare(WC_VERSION, '10.3.0', '>=')) {
    9090            if (!empty($chosen_shipping_methods)) {
    9191                foreach (\WC()->shipping->get_packages() as $package_key => $package) {
     
    9696                        $item->set_method_title($shipping_rate->label);
    9797                        $item->set_method_id($shipping_rate->id);
    98                         $item->set_total($shipping_rate->cost); 
     98                        $item->set_total($shipping_rate->cost);
    9999                        $item->set_taxes($shipping_rate->taxes);
    100100                        $order->add_item($item);
     
    184184        }
    185185
    186          if (in_array($coupon, WC()->cart->get_applied_coupons())) {
     186        if (in_array($coupon, WC()->cart->get_applied_coupons())) {
    187187            return;
    188188        }
     
    206206        $this->addFeeTaxesActionClosure = function ($taxes, $fee) use ($tax) {
    207207            if ($fee->object->name == 'Simpler Discount') {
    208                 $fee->taxes = [-($tax * 100)];
     208                $fee->taxes = [- ($tax * 100)];
    209209                return $fee->taxes;
    210210            }
  • simpler-checkout/tags/1.3.2/includes/Services/ProductFeedService.php

    r3437538 r3449341  
    7373            'price_cents' => $price_cents,
    7474            'shippable'   => $product->needs_shipping(),
    75             'stock'       => (int) $product->get_stock_quantity(),
     75            'stock'       => $this->get_stock_for_feed($product),
    7676            'url'         => $product->get_permalink(),
    7777            'categories'  => $cats,
     
    8787
    8888            $variations = $product->get_available_variations();
    89             foreach ($variations as $v_data) {
    90                 $v_obj = wc_get_product($v_data['variation_id']);
    91                 if ($v_obj) {
    92                     $data['variations'][] = $this->transform_variation($v_obj);
     89            foreach ($variations as $variation) {
     90                $v = wc_get_product($variation['variation_id']);
     91                if ($v) {
     92                    $data['variations'][] = $this->transform_variation($v);
    9393                }
    9494            }
    9595        } else {
    96              $attributes = $this->get_attributes_map($product);
    97              $data['attributes'] = empty($attributes) ? (object) [] : $attributes;
     96            $attributes = $this->get_attributes_map($product);
     97            $data['attributes'] = empty($attributes) ? (object) [] : $attributes;
    9898        }
    9999
     
    117117            'price_cents' => $price_cents,
    118118            'shippable'   => $variation->needs_shipping(),
    119             'stock'       => (int) $variation->get_stock_quantity(),
     119            'stock'       => $this->get_stock_for_feed($variation),
    120120            'attributes'  => $this->get_variation_attributes_map($variation),
    121121        ];
     
    155155
    156156            $options[] = [
    157                 'id' => (string) sanitize_title($name),
     157                'id' => $this->transformationService->getAttributeKey($name),
    158158                'title' => $label,
    159159                'values' => $values
     
    167167        $map = [];
    168168        foreach ($product->get_attributes() as $attribute) {
    169              $key = $this->transformationService->getAttributeKey($attribute->get_name());
    170              $options = $this->transformationService->getAttributeOptions($attribute);
     169            $key = $this->transformationService->getAttributeKey($attribute->get_name());
     170            $options = $this->transformationService->getAttributeOptions($attribute);
    171171
    172              // Map names for CSV-like string
    173              $map[$key] = implode(', ', array_column($options, 'name'));
     172            // Map names for CSV-like string
     173            $map[$key] = implode(', ', array_column($options, 'name'));
    174174        }
    175175        return empty($map) ? [] : $map;
    176176    }
    177177
    178     private function get_variation_attributes_map(\WC_Product_Variation $variation): array
     178    private function get_variation_attributes_map(\WC_Product_Variation $variation)
    179179    {
    180180        $map = [];
    181181        foreach ($variation->get_attributes() as $name => $value) {
     182            if (!$value) {
     183                continue;
     184            }
    182185            $key = $this->transformationService->getAttributeKey($name);
    183186            $map[$key] = (string) $value;
    184187        }
    185         return empty($map) ? [] : $map;
     188        return empty($map) ? (object) [] : $map;
     189    }
     190
     191    private function get_stock_for_feed($product): int
     192    {
     193        if ($product->get_stock_status() === 'outofstock') {
     194            return 0;
     195        }
     196        return $product->get_stock_quantity() ?? -1;
    186197    }
    187198}
  • simpler-checkout/tags/1.3.2/includes/button.php

    r3290493 r3449341  
    1919function simplerwc_load_visual_hook_filters()
    2020{
    21     add_filter(
    22         get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity'),
    23         'simplerwc_add_checkout_after_main_content',
    24         10
    25     );
    26    
     21    $productHook = get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity');
     22    add_filter($productHook, 'simplerwc_add_checkout_after_main_content', 10);
     23
     24    // grouped products should only be added in this hook to avoid the button rendering >1 time
     25    if ($productHook !== 'woocommerce_after_add_to_cart_button') {
     26        add_filter('woocommerce_after_add_to_cart_button', 'simplerwc_add_checkout_for_grouped_product', 10);
     27    }
     28
    2729    if (simplerwc_is_takeover_enable()) {
    2830        return;
     
    100102
    101103    global $product;
     104    if (\is_product()) {
     105        $page_product = \wc_get_product(get_queried_object_id());
     106        if ($page_product && $page_product->is_type('grouped')) {
     107            return;
     108        }
     109    }
     110
    102111    if (apply_filters('simplerwc_should_render_product_button', true, $product)) {
    103112        echo simplerwc_button(get_option('simplerwc_product_button_placement'), simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE);
     113    };
     114}
     115
     116function simplerwc_add_checkout_for_grouped_product()
     117{
     118    if (!simplerwc_should_render_button()) {
     119        return;
     120    }
     121
     122    if (!get_option('simpler_auto_render_product_button')) {
     123        return;
     124    }
     125
     126    global $product;
     127    if (!$product || !$product->is_type('grouped')) {
     128        return;
     129    }
     130    if (apply_filters('simplerwc_should_render_product_button', true, $product)) {
     131        echo simplerwc_button('woocommerce_after_add_to_cart_button', simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE);
    104132    };
    105133}
     
    219247{
    220248    if ($bundle_type = apply_filters('simplerwc_product_is_bundle_container', false,  $product)) {
    221         return ['items' => [simplerwc_get_product_attributes($product,$bundle_type)] ];
    222     }else{
    223         return ['items' => [simplerwc_get_product_attributes($product)] ];
    224     }
     249        return ['items' => [simplerwc_get_product_attributes($product, $bundle_type)]];
     250    }
     251
     252    if ($product->is_type('grouped')) {
     253        $items = [];
     254        foreach ($product->get_children() as $child_id) {
     255            $child = wc_get_product($child_id);
     256            if ($child && $child->is_purchasable() && $child->is_in_stock()) {
     257                $items[] = simplerwc_get_product_attributes($child);
     258            }
     259        }
     260        return ['items' => $items];
     261    }
     262
     263    return ['items' => [simplerwc_get_product_attributes($product)]];
    225264}
    226265
     
    248287            $bundled_items = apply_filters('simplerwc_get_selected_cart_items_linked_to_the_bundle_cart_item', [], $cart, $cart_item, $bundle_type);
    249288            array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item, $bundled_items, $bundle_type));
    250         }else{
     289        } else {
    251290            array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item));
    252291        }
     
    273312 * @param \WC_Product $product The product to extract information from
    274313 */
    275 function simplerwc_get_product_attributes($product,$bundle_type = null, $cart_item = null)
     314function simplerwc_get_product_attributes($product, $bundle_type = null, $cart_item = null)
    276315{
    277316    $attrs = [
     
    294333        $attrs['attributes'] = apply_filters('simplerwc_button_get_product_attributes', $product->get_variation_attributes(), $product, $cart_item);
    295334    }
    296     if($bundle_type){
     335    if ($bundle_type) {
    297336        $attrs['bundle_type'] = $bundle_type;
    298         $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle',$product->get_type(), $bundle_type);
     337        $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle', $product->get_type(), $bundle_type);
    299338        $attrs['bundle_configuration'] = [];
    300         $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product',[], $product, $bundle_type);
    301         foreach($bundled_products as $bundled_product){
     339        $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product', [], $product, $bundle_type);
     340        foreach ($bundled_products as $bundled_product) {
    302341            $attrs['bundle_configuration'][strval($bundled_product->get_id())] = simplerwc_get_product_attributes($bundled_product);
    303342        }
  • simpler-checkout/tags/1.3.2/includes/compat.php

    r3358403 r3449341  
    1010include_once ('Compatibility/pickup.php');
    1111include_once ('Compatibility/tax.php');
     12include_once ('Compatibility/skroutz-slm.php');
  • simpler-checkout/tags/1.3.2/includes/constants.php

    r3437538 r3449341  
    11<?php
    22
    3 const SIMPLERWC_VERSION = '1.3.1';
     3const SIMPLERWC_VERSION = '1.3.2';
    44
    55function simplerwc_get_sdk_uri()
  • simpler-checkout/tags/1.3.2/simpler.php

    r3437538 r3449341  
    88 * Description: Simpler Checkout lets your customers complete their purchases in seconds, with any payment method they want, in any device or browser and without a password.
    99 * Tags: woocommerce, checkout, payments, conversion rate
    10  * Version: 1.3.1
     10 * Version: 1.3.2
    1111 * Requires at least: 5.1
    1212 * Tested up to: 6.8.3
  • simpler-checkout/tags/1.3.2/vendor/autoload.php

    r3437538 r3449341  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd::getLoader();
     7return ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98::getLoader();
  • simpler-checkout/tags/1.3.2/vendor/composer/autoload_classmap.php

    r3437538 r3449341  
    4747    'Simpler\\Models\\OrderShipping' => $baseDir . '/includes/Models/OrderShipping.php',
    4848    'Simpler\\Models\\PaymentMethod' => $baseDir . '/includes/Models/PaymentMethod.php',
     49    'Simpler\\Models\\PickupPoint' => $baseDir . '/includes/Models/PickupPoint.php',
    4950    'Simpler\\Models\\ProductAttribute' => $baseDir . '/includes/Models/ProductAttribute.php',
    5051    'Simpler\\Models\\Quotation' => $baseDir . '/includes/Models/Quotation.php',
  • simpler-checkout/tags/1.3.2/vendor/composer/autoload_real.php

    r3437538 r3449341  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd
     5class ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInita5a44e2e320b3930151b936d56111dbd::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • simpler-checkout/tags/1.3.2/vendor/composer/autoload_static.php

    r3437538 r3449341  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInita5a44e2e320b3930151b936d56111dbd
     7class ComposerStaticInit675b812554ac035a2c0930ccfe45fc98
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    7070        'Simpler\\Models\\OrderShipping' => __DIR__ . '/../..' . '/includes/Models/OrderShipping.php',
    7171        'Simpler\\Models\\PaymentMethod' => __DIR__ . '/../..' . '/includes/Models/PaymentMethod.php',
     72        'Simpler\\Models\\PickupPoint' => __DIR__ . '/../..' . '/includes/Models/PickupPoint.php',
    7273        'Simpler\\Models\\ProductAttribute' => __DIR__ . '/../..' . '/includes/Models/ProductAttribute.php',
    7374        'Simpler\\Models\\Quotation' => __DIR__ . '/../..' . '/includes/Models/Quotation.php',
     
    9293    {
    9394        return \Closure::bind(function () use ($loader) {
    94             $loader->prefixLengthsPsr4 = ComposerStaticInita5a44e2e320b3930151b936d56111dbd::$prefixLengthsPsr4;
    95             $loader->prefixDirsPsr4 = ComposerStaticInita5a44e2e320b3930151b936d56111dbd::$prefixDirsPsr4;
    96             $loader->classMap = ComposerStaticInita5a44e2e320b3930151b936d56111dbd::$classMap;
     95            $loader->prefixLengthsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixLengthsPsr4;
     96            $loader->prefixDirsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixDirsPsr4;
     97            $loader->classMap = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$classMap;
    9798
    9899        }, null, ClassLoader::class);
  • simpler-checkout/tags/1.3.2/vendor/composer/installed.php

    r3437538 r3449341  
    11<?php return array(
    22    'root' => array(
    3         'pretty_version' => '1.3.1',
    4         'version' => '1.3.1.0',
     3        'pretty_version' => '1.3.2',
     4        'version' => '1.3.2.0',
    55        'type' => 'wordpress-plugin',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',
     8        'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa',
    99        'name' => 'simpler-checkout/woo',
    1010        'dev' => false,
     
    1212    'versions' => array(
    1313        'simpler-checkout/woo' => array(
    14             'pretty_version' => '1.3.1',
    15             'version' => '1.3.1.0',
     14            'pretty_version' => '1.3.2',
     15            'version' => '1.3.2.0',
    1616            'type' => 'wordpress-plugin',
    1717            'install_path' => __DIR__ . '/../../',
    1818            'aliases' => array(),
    19             'reference' => 'bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',
     19            'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa',
    2020            'dev_requirement' => false,
    2121        ),
  • simpler-checkout/trunk/README.txt

    r3437538 r3449341  
    55Tested up to: 6.5
    66Requires PHP: 7.0
    7 Stable tag: 1.3.1
     7Stable tag: 1.3.2
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3535
    3636== Changelog ==
     37
     38== 1.3.2
     39Feat: handle grouped products
     40Fix: normalize option keys in product feed
     41Fix: handle stock status in product feed
     42Compat: Skroutz Lockers
    3743
    3844== 1.3.1
  • simpler-checkout/trunk/includes/Models/Order.php

    r3272319 r3449341  
    3838     */
    3939    private $addons;
     40    /**
     41     * @var PickupPoint
     42     */
     43    private $pickupPoint;
    4044
    41     public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null)
     45    public function __construct($simpler_cart_id, $currency, $shipping, $coupon, $simpler_discount, array $cart, $paymentMethod = null, $addons = null, $pickupPoint = null)
    4246    {
    4347        $this->simpler_cart_id    = $simpler_cart_id;
     
    4953        $this->paymentMethod      = $paymentMethod;
    5054        $this->addons             = $addons;
     55        $this->pickupPoint        = $pickupPoint;
    5156    }
    5257
     
    7883            $items,
    7984            isset($json['payment']) ? PaymentMethod::from_json($json['payment']) : null,
    80             isset($json['addons']) ? $json['addons'] : null
     85            isset($json['addons']) ? $json['addons'] : null,
     86            isset($json['pickup_point']) ? PickupPoint::from_json($json['pickup_point']) : null
    8187        );
    8288    }
     
    121127        return $this->addons;
    122128    }
     129
     130    /**
     131     * @return PickupPoint
     132     */
     133    public function get_pickup_point()
     134    {
     135        return $this->pickupPoint;
     136    }
    123137}
  • simpler-checkout/trunk/includes/Services/OrderService.php

    r3417395 r3449341  
    8787
    8888        \WC()->checkout()->set_data_from_cart($order);
    89         if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '10.3.0', '>=' ) ) {
     89        if (defined('WC_VERSION') && version_compare(WC_VERSION, '10.3.0', '>=')) {
    9090            if (!empty($chosen_shipping_methods)) {
    9191                foreach (\WC()->shipping->get_packages() as $package_key => $package) {
     
    9696                        $item->set_method_title($shipping_rate->label);
    9797                        $item->set_method_id($shipping_rate->id);
    98                         $item->set_total($shipping_rate->cost); 
     98                        $item->set_total($shipping_rate->cost);
    9999                        $item->set_taxes($shipping_rate->taxes);
    100100                        $order->add_item($item);
     
    184184        }
    185185
    186          if (in_array($coupon, WC()->cart->get_applied_coupons())) {
     186        if (in_array($coupon, WC()->cart->get_applied_coupons())) {
    187187            return;
    188188        }
     
    206206        $this->addFeeTaxesActionClosure = function ($taxes, $fee) use ($tax) {
    207207            if ($fee->object->name == 'Simpler Discount') {
    208                 $fee->taxes = [-($tax * 100)];
     208                $fee->taxes = [- ($tax * 100)];
    209209                return $fee->taxes;
    210210            }
  • simpler-checkout/trunk/includes/Services/ProductFeedService.php

    r3437538 r3449341  
    7373            'price_cents' => $price_cents,
    7474            'shippable'   => $product->needs_shipping(),
    75             'stock'       => (int) $product->get_stock_quantity(),
     75            'stock'       => $this->get_stock_for_feed($product),
    7676            'url'         => $product->get_permalink(),
    7777            'categories'  => $cats,
     
    8787
    8888            $variations = $product->get_available_variations();
    89             foreach ($variations as $v_data) {
    90                 $v_obj = wc_get_product($v_data['variation_id']);
    91                 if ($v_obj) {
    92                     $data['variations'][] = $this->transform_variation($v_obj);
     89            foreach ($variations as $variation) {
     90                $v = wc_get_product($variation['variation_id']);
     91                if ($v) {
     92                    $data['variations'][] = $this->transform_variation($v);
    9393                }
    9494            }
    9595        } else {
    96              $attributes = $this->get_attributes_map($product);
    97              $data['attributes'] = empty($attributes) ? (object) [] : $attributes;
     96            $attributes = $this->get_attributes_map($product);
     97            $data['attributes'] = empty($attributes) ? (object) [] : $attributes;
    9898        }
    9999
     
    117117            'price_cents' => $price_cents,
    118118            'shippable'   => $variation->needs_shipping(),
    119             'stock'       => (int) $variation->get_stock_quantity(),
     119            'stock'       => $this->get_stock_for_feed($variation),
    120120            'attributes'  => $this->get_variation_attributes_map($variation),
    121121        ];
     
    155155
    156156            $options[] = [
    157                 'id' => (string) sanitize_title($name),
     157                'id' => $this->transformationService->getAttributeKey($name),
    158158                'title' => $label,
    159159                'values' => $values
     
    167167        $map = [];
    168168        foreach ($product->get_attributes() as $attribute) {
    169              $key = $this->transformationService->getAttributeKey($attribute->get_name());
    170              $options = $this->transformationService->getAttributeOptions($attribute);
     169            $key = $this->transformationService->getAttributeKey($attribute->get_name());
     170            $options = $this->transformationService->getAttributeOptions($attribute);
    171171
    172              // Map names for CSV-like string
    173              $map[$key] = implode(', ', array_column($options, 'name'));
     172            // Map names for CSV-like string
     173            $map[$key] = implode(', ', array_column($options, 'name'));
    174174        }
    175175        return empty($map) ? [] : $map;
    176176    }
    177177
    178     private function get_variation_attributes_map(\WC_Product_Variation $variation): array
     178    private function get_variation_attributes_map(\WC_Product_Variation $variation)
    179179    {
    180180        $map = [];
    181181        foreach ($variation->get_attributes() as $name => $value) {
     182            if (!$value) {
     183                continue;
     184            }
    182185            $key = $this->transformationService->getAttributeKey($name);
    183186            $map[$key] = (string) $value;
    184187        }
    185         return empty($map) ? [] : $map;
     188        return empty($map) ? (object) [] : $map;
     189    }
     190
     191    private function get_stock_for_feed($product): int
     192    {
     193        if ($product->get_stock_status() === 'outofstock') {
     194            return 0;
     195        }
     196        return $product->get_stock_quantity() ?? -1;
    186197    }
    187198}
  • simpler-checkout/trunk/includes/button.php

    r3290493 r3449341  
    1919function simplerwc_load_visual_hook_filters()
    2020{
    21     add_filter(
    22         get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity'),
    23         'simplerwc_add_checkout_after_main_content',
    24         10
    25     );
    26    
     21    $productHook = get_option('simplerwc_product_button_placement', 'woocommerce_after_add_to_cart_quantity');
     22    add_filter($productHook, 'simplerwc_add_checkout_after_main_content', 10);
     23
     24    // grouped products should only be added in this hook to avoid the button rendering >1 time
     25    if ($productHook !== 'woocommerce_after_add_to_cart_button') {
     26        add_filter('woocommerce_after_add_to_cart_button', 'simplerwc_add_checkout_for_grouped_product', 10);
     27    }
     28
    2729    if (simplerwc_is_takeover_enable()) {
    2830        return;
     
    100102
    101103    global $product;
     104    if (\is_product()) {
     105        $page_product = \wc_get_product(get_queried_object_id());
     106        if ($page_product && $page_product->is_type('grouped')) {
     107            return;
     108        }
     109    }
     110
    102111    if (apply_filters('simplerwc_should_render_product_button', true, $product)) {
    103112        echo simplerwc_button(get_option('simplerwc_product_button_placement'), simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE);
     113    };
     114}
     115
     116function simplerwc_add_checkout_for_grouped_product()
     117{
     118    if (!simplerwc_should_render_button()) {
     119        return;
     120    }
     121
     122    if (!get_option('simpler_auto_render_product_button')) {
     123        return;
     124    }
     125
     126    global $product;
     127    if (!$product || !$product->is_type('grouped')) {
     128        return;
     129    }
     130    if (apply_filters('simplerwc_should_render_product_button', true, $product)) {
     131        echo simplerwc_button('woocommerce_after_add_to_cart_button', simplerwc_prepare_product($product), SIMPLERWC_BTNPOS_PRODUCT_PAGE);
    104132    };
    105133}
     
    219247{
    220248    if ($bundle_type = apply_filters('simplerwc_product_is_bundle_container', false,  $product)) {
    221         return ['items' => [simplerwc_get_product_attributes($product,$bundle_type)] ];
    222     }else{
    223         return ['items' => [simplerwc_get_product_attributes($product)] ];
    224     }
     249        return ['items' => [simplerwc_get_product_attributes($product, $bundle_type)]];
     250    }
     251
     252    if ($product->is_type('grouped')) {
     253        $items = [];
     254        foreach ($product->get_children() as $child_id) {
     255            $child = wc_get_product($child_id);
     256            if ($child && $child->is_purchasable() && $child->is_in_stock()) {
     257                $items[] = simplerwc_get_product_attributes($child);
     258            }
     259        }
     260        return ['items' => $items];
     261    }
     262
     263    return ['items' => [simplerwc_get_product_attributes($product)]];
    225264}
    226265
     
    248287            $bundled_items = apply_filters('simplerwc_get_selected_cart_items_linked_to_the_bundle_cart_item', [], $cart, $cart_item, $bundle_type);
    249288            array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item, $bundled_items, $bundle_type));
    250         }else{
     289        } else {
    251290            array_push($ret['items'], simplerwc_get_cart_item_attributes($cart_item));
    252291        }
     
    273312 * @param \WC_Product $product The product to extract information from
    274313 */
    275 function simplerwc_get_product_attributes($product,$bundle_type = null, $cart_item = null)
     314function simplerwc_get_product_attributes($product, $bundle_type = null, $cart_item = null)
    276315{
    277316    $attrs = [
     
    294333        $attrs['attributes'] = apply_filters('simplerwc_button_get_product_attributes', $product->get_variation_attributes(), $product, $cart_item);
    295334    }
    296     if($bundle_type){
     335    if ($bundle_type) {
    297336        $attrs['bundle_type'] = $bundle_type;
    298         $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle',$product->get_type(), $bundle_type);
     337        $attrs['product_type'] = apply_filters('simplerwc_get_product_type_of_the_bundle', $product->get_type(), $bundle_type);
    299338        $attrs['bundle_configuration'] = [];
    300         $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product',[], $product, $bundle_type);
    301         foreach($bundled_products as $bundled_product){
     339        $bundled_products = apply_filters('simplerwc_get_all_products_linked_to_the_bundle_product', [], $product, $bundle_type);
     340        foreach ($bundled_products as $bundled_product) {
    302341            $attrs['bundle_configuration'][strval($bundled_product->get_id())] = simplerwc_get_product_attributes($bundled_product);
    303342        }
  • simpler-checkout/trunk/includes/compat.php

    r3358403 r3449341  
    1010include_once ('Compatibility/pickup.php');
    1111include_once ('Compatibility/tax.php');
     12include_once ('Compatibility/skroutz-slm.php');
  • simpler-checkout/trunk/includes/constants.php

    r3437538 r3449341  
    11<?php
    22
    3 const SIMPLERWC_VERSION = '1.3.1';
     3const SIMPLERWC_VERSION = '1.3.2';
    44
    55function simplerwc_get_sdk_uri()
  • simpler-checkout/trunk/simpler.php

    r3437538 r3449341  
    88 * Description: Simpler Checkout lets your customers complete their purchases in seconds, with any payment method they want, in any device or browser and without a password.
    99 * Tags: woocommerce, checkout, payments, conversion rate
    10  * Version: 1.3.1
     10 * Version: 1.3.2
    1111 * Requires at least: 5.1
    1212 * Tested up to: 6.8.3
  • simpler-checkout/trunk/vendor/autoload.php

    r3437538 r3449341  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd::getLoader();
     7return ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98::getLoader();
  • simpler-checkout/trunk/vendor/composer/autoload_classmap.php

    r3437538 r3449341  
    4747    'Simpler\\Models\\OrderShipping' => $baseDir . '/includes/Models/OrderShipping.php',
    4848    'Simpler\\Models\\PaymentMethod' => $baseDir . '/includes/Models/PaymentMethod.php',
     49    'Simpler\\Models\\PickupPoint' => $baseDir . '/includes/Models/PickupPoint.php',
    4950    'Simpler\\Models\\ProductAttribute' => $baseDir . '/includes/Models/ProductAttribute.php',
    5051    'Simpler\\Models\\Quotation' => $baseDir . '/includes/Models/Quotation.php',
  • simpler-checkout/trunk/vendor/composer/autoload_real.php

    r3437538 r3449341  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd
     5class ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInita5a44e2e320b3930151b936d56111dbd', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit675b812554ac035a2c0930ccfe45fc98', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInita5a44e2e320b3930151b936d56111dbd::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • simpler-checkout/trunk/vendor/composer/autoload_static.php

    r3437538 r3449341  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInita5a44e2e320b3930151b936d56111dbd
     7class ComposerStaticInit675b812554ac035a2c0930ccfe45fc98
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    7070        'Simpler\\Models\\OrderShipping' => __DIR__ . '/../..' . '/includes/Models/OrderShipping.php',
    7171        'Simpler\\Models\\PaymentMethod' => __DIR__ . '/../..' . '/includes/Models/PaymentMethod.php',
     72        'Simpler\\Models\\PickupPoint' => __DIR__ . '/../..' . '/includes/Models/PickupPoint.php',
    7273        'Simpler\\Models\\ProductAttribute' => __DIR__ . '/../..' . '/includes/Models/ProductAttribute.php',
    7374        'Simpler\\Models\\Quotation' => __DIR__ . '/../..' . '/includes/Models/Quotation.php',
     
    9293    {
    9394        return \Closure::bind(function () use ($loader) {
    94             $loader->prefixLengthsPsr4 = ComposerStaticInita5a44e2e320b3930151b936d56111dbd::$prefixLengthsPsr4;
    95             $loader->prefixDirsPsr4 = ComposerStaticInita5a44e2e320b3930151b936d56111dbd::$prefixDirsPsr4;
    96             $loader->classMap = ComposerStaticInita5a44e2e320b3930151b936d56111dbd::$classMap;
     95            $loader->prefixLengthsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixLengthsPsr4;
     96            $loader->prefixDirsPsr4 = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$prefixDirsPsr4;
     97            $loader->classMap = ComposerStaticInit675b812554ac035a2c0930ccfe45fc98::$classMap;
    9798
    9899        }, null, ClassLoader::class);
  • simpler-checkout/trunk/vendor/composer/installed.php

    r3437538 r3449341  
    11<?php return array(
    22    'root' => array(
    3         'pretty_version' => '1.3.1',
    4         'version' => '1.3.1.0',
     3        'pretty_version' => '1.3.2',
     4        'version' => '1.3.2.0',
    55        'type' => 'wordpress-plugin',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',
     8        'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa',
    99        'name' => 'simpler-checkout/woo',
    1010        'dev' => false,
     
    1212    'versions' => array(
    1313        'simpler-checkout/woo' => array(
    14             'pretty_version' => '1.3.1',
    15             'version' => '1.3.1.0',
     14            'pretty_version' => '1.3.2',
     15            'version' => '1.3.2.0',
    1616            'type' => 'wordpress-plugin',
    1717            'install_path' => __DIR__ . '/../../',
    1818            'aliases' => array(),
    19             'reference' => 'bb3716a6afa9e2e353f9e9bdd1ba65ce44e673c0',
     19            'reference' => '30c2cdd0d19ecd7dfa2ab2616847646a3f8bd6aa',
    2020            'dev_requirement' => false,
    2121        ),
Note: See TracChangeset for help on using the changeset viewer.