Plugin Directory

Changeset 2620240


Ignore:
Timestamp:
10/26/2021 03:09:22 PM (4 years ago)
Author:
kakaroto84
Message:

1.4.0 Discount coupon validation

Location:
wc-yabi/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wc-yabi/trunk/includes/ajax.php

    r2590939 r2620240  
    4949        }
    5050       
     51        /* Coupons */
     52        $numitem = 0;
     53        $order_items = $order->get_items('coupon');
     54        foreach( $order_items as $item_id => $item )
     55        {
     56            $order_discount_amount = wc_get_order_item_meta( $item_id, 'discount_amount', true );
     57            $order_discount_tax_amount = wc_get_order_item_meta( $item_id, 'discount_amount_tax', true );
     58           
     59            if( isset( $products[ $numitem ] ) )
     60            {
     61                $products[ $numitem ][ 'value' ] = floatval( $products[ $numitem ][ 'value' ] ) - floatval( $order_discount_amount );
     62                $products[ $numitem ][ 'tax' ] = floatval( $products[ $numitem ][ 'tax' ] ) - floatval( $order_discount_tax_amount );
     63               
     64                $products[ $numitem ][ 'percent' ] = round( $products[ $numitem ][ 'tax' ] * 100 / $products[ $numitem ][ 'value' ] );
     65            }           
     66           
     67            $numitem++;
     68        }       
     69        /***********/
     70       
    5171        $dueDate = date( "Y-m-d" );
    5272        $dateTime = date( "Y-m-d" ) .'T'. date("H:i:s") .'Z';
     
    5676            'dueDate' => $dueDate,
    5777            'dateTime' => $dateTime,
    58         );
    59        
     78        );     
     79               
    6080        $graphQL = yabi_create_invoice_person( $person, $products, $payment );
    6181       
  • wc-yabi/trunk/readme.txt

    r2590939 r2620240  
    44Donate link: https://www.paypal.me/datakun
    55Requires at least: 5.5
    6 Tested up to: 5.8
     6Tested up to: 5.8.1
    77Requires PHP: 7.4
    88Stable tag: trunk
     
    9090= 1.3.1 =
    9191* The taxscheme field was deleted, the field is no longer required
     92= 1.4.0 =
     93* Discount coupon validation
  • wc-yabi/trunk/wc-yabi.php

    r2590939 r2620240  
    99 * Plugin URI:        https://mireunion.com/yabi
    1010 * Description:       Create your electronic invoices of purchases made in woocommerce with Yabi
    11  * Version:           1.3.1
     11 * Version:           1.4.0
    1212 * Author:            Mex Avila
    1313 * Author URI:        https://datakun.com/
Note: See TracChangeset for help on using the changeset viewer.