Plugin Directory

Changeset 2833784


Ignore:
Timestamp:
12/14/2022 01:50:48 PM (3 years ago)
Author:
doshii
Message:

Submitting changes for release 2.5.4

Location:
doshii/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • doshii/trunk/README.txt

    r2826771 r2833784  
    55Requires at least: 4.7
    66Tested up to: 5.8.0
    7 Stable tag: 2.5.3
     7Stable tag: 2.5.4
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    5959
    6060== Changelog ==
     61
     62= 2.5.4 =
     63
     64Removed coupons from surcounts
    6165
    6266= 2.5.3 =
  • doshii/trunk/doshii_function.php

    r2826771 r2833784  
    77Author URI: https://www.doshii.io
    88Contributors:
    9 Version: 2.5.3
     9Version: 2.5.4
    1010*/
    1111
  • doshii/trunk/include/woo-doshii-initialise.php

    r2826771 r2833784  
    4040       'x-doshii-location-id' => $locationId.'',
    4141       'content-Type' => 'application/json',
    42        'x-doshii-writeout' => 'WooCommerce 2.5.3',
     42       'x-doshii-writeout' => 'WooCommerce 2.5.4',
    4343    );
    4444
  • doshii/trunk/include/woo-doshii-product-sync.php

    r2826771 r2833784  
    4848            'x-doshii-location-id' => $locationId.'',
    4949            'content-Type' => 'application/json',
    50             'x-doshii-writeout' => 'WooCommerce 2.5.3',
     50            'x-doshii-writeout' => 'WooCommerce 2.5.4',
    5151        )
    5252    ));
  • doshii/trunk/include/woo-order-api.php

    r2826771 r2833784  
    142142        'value' => $taxTotal
    143143    ]);
    144 
    145     foreach ( $order->get_items( 'coupon' ) as $coupon ) {
    146         $couponCode = $coupon->get_code();
    147         $amount = $coupon->get_discount();
    148         $couponData = $coupon->get_meta('coupon_data');
    149         $couponType = $couponData['discount_type'];
    150 
    151         $couponTypeLabel = ucwords(str_replace('_', ' ', $couponType));
    152 
    153         // valid types: fixed_cart, fixed_product, percent
    154         $surcountType = $couponType == 'percent' ? 'percentage' : 'absolute';
    155 
    156         if (!empty($amount) && $amount > 0) {
    157             $surcountValue = -doshii_to_cents($amount);
    158             if ($surcountType === 'percentage') {
    159                 $amount = -$amount; // negative percent
    160                 $orderSubtotal = $order->get_subtotal(); // we need to calculate the coupon discount based on order subtotal
    161                 $surcountValue = -doshii_to_cents($orderSubtotal * ($amount / 100)); // percentage -> amount = %, value = $
    162             } else {
    163                 $amount = $surcountValue; // absolute -> amount = value
    164             }
    165             array_push($surcounts, (object)[
    166                 'name' => "$couponTypeLabel Coupon: $couponCode",
    167                 'amount' => $amount,
    168                 'type' => $surcountType,
    169                 'value' => $surcountValue
    170             ]);
    171         }
    172     }
    173144
    174145    $fullname = $first_name.' '.$last_name;
     
    708679                'accept' => 'application/json',
    709680                'Accept-encoding' => 'gzip',
    710                 'x-doshii-writeout' => 'WooCommerce 2.5.3',
     681                'x-doshii-writeout' => 'WooCommerce 2.5.4',
    711682            ),
    712683            'body' => json_encode($doshiiOrderPayload)
  • doshii/trunk/include/woo-order-status.php

    r2826771 r2833784  
    3939                'x-doshii-location-id' => $doshii_options['location_id'].'',
    4040                'content-Type' => 'application/json',
    41                 'x-doshii-writeout' => 'WooCommerce 2.5.3',
     41                'x-doshii-writeout' => 'WooCommerce 2.5.4',
    4242            )
    4343        ));
Note: See TracChangeset for help on using the changeset viewer.