Plugin Directory

Changeset 3357953


Ignore:
Timestamp:
09/08/2025 01:53:49 PM (7 months ago)
Author:
ceretax
Message:

v1.4.4
2025-08-13 - version 1.4.4

  • fix : The transactions can be fully refunded
  • fix : We have resolved the tax amount mismatch in tax total column and summary
  • fix : Taxes are now displayed for variable items also
Location:
ceretax
Files:
27 added
5 edited

Legend:

Unmodified
Added
Removed
  • ceretax/trunk/ceretax.php

    r3320210 r3357953  
    33 * Plugin Name: CereTax
    44 * Plugin URI: https://wordpress.org/plugins/ceretax/
    5  * Description: Simplify sales tax complexity with CereTax for WooCommerce.
    6  * Version: 1.4.3
     5 * Description: Simplify sales tax complexity with CereTax for WooCommerce. 
     6 * Version: 1.4.4
    77 * Author: CereTax, Inc.
    88 * Author URI: https://www.ceretax.com/
     
    3939// Version of plugin.
    4040if ( ! defined( 'CWAFC_VERSION' ) ) {
    41     define( 'CWAFC_VERSION', '1.4.2' );
     41    define( 'CWAFC_VERSION', '1.4.4' );
    4242}
    4343
  • ceretax/trunk/changelog.txt

    r3320210 r3357953  
    5656* fix - Resolved PHP warning errors
    5757* add - Included 'shipFromAddress' parameter in the ceretax API request
     58
     592025-08-13 - version 1.4.4
     60* fix : The transactions can be fully refunded
     61* fix : We have resolved the tax amount mismatch in tax total column and summary
     62* fix : Taxes are now displayed for variable items also
  • ceretax/trunk/inc/admin/class-cwafc-admin-action.php

    r3320210 r3357953  
    611611            $ceretax_data_lineitem = json_decode( get_post_meta( $order_id, 'ceretax_data_lineitem', true ) );
    612612            $ceretax_data          = json_decode( get_post_meta( $order_id, 'ceretax_data', true ) );
     613            $parent_order_id       = $order->get_meta( '_dws_lo_parent', true );
     614            $order_shipping_total  = $order->get_shipping_total();     
     615
     616            if ( ! empty( $ceretax_data_lineitem ) && ! empty( $ceretax_data ) && ! empty( $order ) ) {
     617
     618                if ( ! empty( $product ) ) {
     619
     620                    echo '<td class="ceretax_line_value" width="7%">';
     621               
     622                    if ( is_array( $ceretax_data_lineitem ) ) {
     623                        $ceretax_items_data = $ceretax_data_lineitem['invoice']['lineItems'];
     624                    }
     625
     626                    if ( is_object( $ceretax_data_lineitem ) && is_object( $ceretax_data ) ) {
     627                        $ceretax_items_data = $ceretax_data_lineitem->invoice->lineItems;
     628                        $ceretax_data       = $ceretax_data->invoice->lineItems;
     629               
     630                        if ( ! empty( $ceretax_items_data ) && ! empty( $ceretax_data ) ) {
     631               
     632                            // Correct the product ID for variable products
     633                            $product        = $item->get_product();
     634                            $product_id     = $product->get_id();
     635                            $parent_id      = $product->get_parent_id();
     636                            $sku            = $product->get_sku();
     637               
     638                            $line_item_total_tax_amount = 0;
     639                            $line_item_calc_base_amount = 0;
     640                            $line_item_revenue_amount   = 0;
     641                            $line_item_total_tax        = 0;
     642               
     643                            // Filter the correct line item from Ceretax data
     644                            if ( ! empty( $parent_order_id ) ) {
     645               
     646                                $filtered = array_filter(
     647                                    $ceretax_items_data,
     648                                    function ( $filtered_item ) use ( $product_id, $item_id ) {
     649                                        return isset( $filtered_item->itemNumber ) && (string)$filtered_item->itemNumber === (string)$product_id && isset( $filtered_item->lineId ) && $filtered_item->lineId == $item_id;
     650                                    }
     651                                );
     652                               
     653                                $refunded_filtered = array_filter(
     654                                    $ceretax_data,
     655                                    function ( $refunded_item ) use ( $product_id, $item_id ) {
     656                                        return isset( $refunded_item->itemNumber ) && (string)$refunded_item->itemNumber === (string)$product_id && isset( $refunded_item->lineId ) && $refunded_item->lineId == $item_id;
     657                                    }
     658                                );
     659                               
     660                            } else {
     661                                $filtered = array_filter( $ceretax_items_data, function ( $filtered_item ) use ( $product_id, $parent_id, $sku ) {
     662                                    return (
     663                                        ( isset($filtered_item->itemNumber) && (
     664                                            (string) $filtered_item->itemNumber === (string) $product_id ||
     665                                            (string) $filtered_item->itemNumber === (string) $parent_id ||
     666                                            (string) $filtered_item->itemNumber === (string) $sku
     667                                        ) )
     668                                    );
     669                                });
     670                               
     671                                $refunded_filtered = array_filter(
     672                                    $ceretax_data,
     673                                    function ( $refunded_item ) use ( $product_id ) {
     674                                        return isset( $refunded_item->itemNumber ) && (string)$refunded_item->itemNumber === (string)$product_id;
     675                                    }
     676                                );
     677                            }
     678               
     679                            $line_item_revenue_amount = ! empty( $filtered ) ? round( reset( $filtered )->revenue, 2 ) : 0;
     680                            $line_item_taxe_breaks    = ! empty( $filtered ) ? reset( $filtered )->taxes : array();
     681               
     682                            if ( ! empty( $line_item_taxe_breaks ) && is_array( $line_item_taxe_breaks ) ) {
     683                                foreach ( $line_item_taxe_breaks as $key => $val ) {
     684                                    if ( ! empty( $val->calculationBaseAmt ) && ( $val->calculationBaseAmt >= $line_item_revenue_amount ) ) {
     685                                        $line_item_calc_base_amount = $val->calculationBaseAmt;
     686               
     687                                        if ( $val->taxTypeClassDesc !== 'RETAIL DELIVERY FEE' ) {
     688                                            $line_item_total_tax_amount += ( $val->totalTax - $val->transactionChargesTax );
     689                                        }
     690                                    }
     691                                }
     692                            }
     693               
     694                            if ( ! empty( $line_item_calc_base_amount ) ) {
     695                                $line_item_total_tax = $line_item_total_tax_amount;
     696                            }
     697               
     698                            $total_line_tax                 = ! empty( $filtered ) ? reset( $filtered )->totalTaxLine : null;
     699                            $total_line_refunded_tax        = ! empty( $refunded_filtered ) ? reset( $refunded_filtered )->totalTaxLine : null;
     700                            $ceretax_refunded_line_item_tax = $item->get_meta( '_ceretax_refunded_line_item_tax' );
     701                           
     702                            echo '<div class="view">';
     703                            echo wp_kses_post( wc_price( $line_item_total_tax, array( 'currency' => $order->get_currency() ) ) );
     704               
     705                            if ( is_array( $order->get_refunds() ) && count( $order->get_refunds() ) > 0 && ! empty( $ceretax_refunded_line_item_tax ) ) {
     706                                echo '<small class="refunded">' . wp_kses_post( wc_price( -1 * $ceretax_refunded_line_item_tax, array( 'currency' => $order->get_currency() ) ) ) . '</small>';
     707                            }
     708               
     709                            echo '</div>';
     710               
     711                            echo '<div class="refund" style="display: none;">
     712                                <input type="text" name="ceretax_line_total[' . absint( $item_id ) . ']" placeholder="' . esc_attr( wc_format_localized_price( 0 ) ) . '" class="refund_line_tax ceretax_line_total wc_input_price" size="4" data-line-tax="' . esc_attr( wc_format_localized_price( round( $line_item_total_tax, 2 ) ) ) . '" />
     713                            </div>';
     714                        }
     715                    }
     716               
     717                    echo '</td>';
     718           
     719                   
     720                } elseif ( $item instanceof WC_Order_Item_Fee && $item->get_name() === $cere_tax_name ) {
     721                    echo '<td class="ceretax_line_value" width="7%"></td>';
     722                } elseif ( $item instanceof WC_Order_Item_Shipping ) {
     723
     724                    echo '<td class="ceretax_line_value" width="7%">';
     725
     726                    $shipping_tax_amount            = 0;
     727                    $shipping_line_total            = $item['total'];
     728                    $ceretax_refunded_line_item_tax = $item->get_meta( '_ceretax_refunded_line_item_tax' );
     729                    if ( ! empty( $item['total'] ) && is_object( $ceretax_data_lineitem ) ) {
     730                        $ceretax_items_data = $ceretax_data_lineitem->invoice->lineItems;
     731                        if ( ! empty( $ceretax_items_data ) ) {
     732                            $ceretax_items_count = 0;
     733                            foreach ( $ceretax_items_data as $item_data ) {
     734                                $line_item_tax_breaks         = $item_data->taxes;
     735                                $transaction_charges_tax      = 0;
     736                                $tras_charge_calc_base_amount = 0;
     737                                if ( ! empty( $line_item_tax_breaks ) ) {
     738                                    foreach ( $line_item_tax_breaks as $key => $val ) {
     739                                        if ( ! empty( $val->transactionChargesTax ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
     740                                            // $tras_charge_calc_base_amount = $val->transactionChargesCalculationBaseAmt; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
     741                                            if ( $val->taxTypeClassDesc !== 'RETAIL DELIVERY FEE' ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
     742                                                $transaction_charges_tax = $transaction_charges_tax + $val->transactionChargesTax; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
     743                                            }
     744                                        }
     745                                    }
     746                                }
     747                                if ( ! empty( $transaction_charges_tax ) ) {
     748                                    $ceretax_items_count++; // phpcs:ignore WordPress.PHP.PreIncrement.PreIncrement
     749                                    // $shipping_tax_amount = $shipping_tax_amount + ( $transaction_charges_tax ) * ( $shipping_line_total / $tras_charge_calc_base_amount );
     750                                    $shipping_tax_amount += $transaction_charges_tax;
     751                                }
     752                            }
     753                        }
     754                    }
     755                    if ( ! empty( $shipping_tax_amount ) && ! empty( $order_shipping_total ) ) {
     756                        $shipping_tax_amount = ( $shipping_tax_amount / $order_shipping_total ) * $shipping_line_total;
     757                    } else {
     758                        $shipping_tax_amount = 0;
     759                    }
     760                    echo '<div class="view">';
     761                    echo wp_kses_post( wc_price( $shipping_tax_amount, array( 'currency' => $order->get_currency() ) ) );
     762                    if ( is_array( $order->get_refunds() ) && count( $order->get_refunds() ) > 0 && ! empty( $ceretax_refunded_line_item_tax ) ) {
     763                        echo '<small class="refunded">' . wp_kses_post( wc_price( -1 * $ceretax_refunded_line_item_tax, array( 'currency' => $order->get_currency() ) ) ) . '</small>';
     764                    }
     765                    echo '</div>';
     766
     767                    echo '<div class="refund" style="display: none;">
     768                        <input type="text" name="ceretax_shipping_line_total[' . absint( $item_id ) . ']" placeholder="' . esc_attr( wc_format_localized_price( 0 ) ) . '" class="refund_line_tax ceretax_shipping_line_total wc_input_price" size="4" data-shipping-tax="' . esc_attr( wc_format_localized_price( round( $shipping_tax_amount, 2 ) ) ) . '" />
     769                    </div>';
     770                    echo '</td>';
     771                } else {
     772                    echo '<td class="ceretax_line_value" width="7%">';
     773                    echo '</td>';
     774                }
     775            }
     776        }
     777
     778        /**
     779         * Add admin order line item column header.
     780         *
     781         * @param object $product Product object.
     782         * @param object $item Product item object.
     783         * @param string $item_id Order object.
     784         * @return void
     785         */
     786        public function action__cwafc_woocommerce_admin_order_item_values_bckup( $product, $item, $item_id ) {
     787
     788            // phpcs:disable WordPress.Security.NonceVerification
     789            $order_id = null;
     790            if ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) {
     791                $order_id = sanitize_text_field( wp_unslash( $_GET['post'] ) );
     792            } elseif ( isset( $_GET['id'] ) && ! empty( $_GET['id'] ) ) {
     793                $order_id = sanitize_text_field( wp_unslash( $_GET['id'] ) );
     794            } else {
     795                $order_id = null;
     796            }
     797            if ( empty( $order_id ) && isset( $_POST['order_id'] ) ) {
     798                $order_id = sanitize_text_field( wp_unslash( $_POST['order_id'] ) );
     799            }
     800            // phpcs:enable WordPress.Security.NonceVerification
     801
     802            $cere_tax_name         = get_option( CWAFC_PREFIX . '_cere_tax_name', 'Tax' );
     803            $order                 = wc_get_order( $order_id );
     804            $ceretax_data_lineitem = json_decode( get_post_meta( $order_id, 'ceretax_data_lineitem', true ) );
     805            $ceretax_data          = json_decode( get_post_meta( $order_id, 'ceretax_data', true ) );
    613806
    614807            if ( ! empty( $ceretax_data_lineitem ) && ! empty( $ceretax_data ) && ! empty( $order ) ) {
     
    634827                            $filtered = array_filter(
    635828                                $ceretax_items_data,
    636                                 function ( $filtered_item ) use ( $product_id ) {
    637                                     return isset( $filtered_item->itemNumber ) && $filtered_item->itemNumber == $product_id; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
     829                                function ( $filtered_item ) use ( $product_id, $item_id ) {
     830                                    return isset( $filtered_item->itemNumber ) && $filtered_item->itemNumber == $product_id && isset( $filtered_item->lineId ) && $filtered_item->lineId == $item_id; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
    638831                                }
    639832                            );
     
    642835                                $ceretax_data,
    643836                                function ( $refunded_item ) use ( $product_id ) {
    644                                     return isset( $refunded_item->itemNumber ) && $refunded_item->itemNumber == $product_id; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
     837                                    return isset( $refunded_item->itemNumber ) && $refunded_item->itemNumber == $product_id && isset( $refunded_item->lineId ) && $refunded_item->lineId == $item_id; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
    645838                                }
    646839                            );
  • ceretax/trunk/inc/class-cwafc.php

    r3320210 r3357953  
    574574            $cere_tax_name   = get_option( CWAFC_PREFIX . '_cere_tax_name', 'Tax' );
    575575
    576             if ( isset( $custom_tax_rate ) && is_numeric( $custom_tax_rate ) ) {
     576            if ( isset( $custom_tax_rate ) && is_numeric( $custom_tax_rate ) ) {               
    577577                $tax = $custom_tax_rate;
    578 
    579                 // Add recurring fee for subscription product.
     578                error_log('tax: '.$tax);
     579                // Add recurring fee for subscription product.         
    580580                if ( ! empty( $cart->recurring_cart_key ) ) {
    581                     // Add fee only for recurring carts.
    582                     $ceretax_tmp_data            = get_option( 'ceretax_tmp_data' );
    583                     $ceretax_tmp_data            = json_decode( $ceretax_tmp_data );
    584                     $ceretax_tmp_items_data      = $ceretax_tmp_data->invoice->lineItems;
    585                     $total_line_tran_charges_tax = 0;
     581                    $ceretax_tmp_data       = get_option( 'ceretax_tmp_data' );
     582                    $ceretax_tmp_data       = json_decode( $ceretax_tmp_data );                 
     583                    $ceretax_tmp_items_data = ! empty( $ceretax_tmp_data->invoice->lineItems ) ? $ceretax_tmp_data->invoice->lineItems : array();
     584                    $total_recurring_fee = 0;
    586585                    if ( ! WC()->cart->is_empty() && ! empty( $ceretax_tmp_items_data ) && is_array( $ceretax_tmp_items_data ) ) {
    587                         $item_count          = 0;
    588                         $total_recurring_fee = 0;
    589                         foreach ( $cart->get_cart() as $cart_item_id => $cart_item ) {
    590                             $line_item_recurring_tax_amount = 0;
    591                             $line_item_calc_base_amount     = 0;
    592                             $line_item_revenue_amount       = 0;
    593                             $line_item_total_tax            = 0;
    594                             $product_id                     = $cart_item['product_id'];
    595 
     586                        foreach ( $cart->get_cart() as $cart_item ) {
     587                            $product_id   = $cart_item['product_id'];
     588                            $variation_id = ! empty( $cart_item['variation_id'] ) ? $cart_item['variation_id'] : 0;
    596589                            if ( class_exists( 'WC_Subscriptions_Product' ) && WC_Subscriptions_Product::is_subscription( $product_id ) ) {
    597                                 $filtered                 = array_filter(
     590                                $filtered = array_filter(
    598591                                    $ceretax_tmp_items_data,
    599                                     function ( $filtered_item ) use ( $product_id ) {
    600                                         return isset( $filtered_item->itemNumber ) && $filtered_item->itemNumber == $product_id; // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison, WordPress.NamingConventions.ValidVariableName
     592                                    function ( $filtered_item ) use ( $product_id, $variation_id ) {
     593                                        return isset( $filtered_item->itemNumber ) && in_array(
     594                                            (string) $filtered_item->itemNumber,
     595                                            array( (string) $product_id, (string) $variation_id ),
     596                                            true
     597                                        );
    601598                                    }
    602599                                );
    603                                 $line_item_revenue_amount = ! empty( $filtered ) ? reset( $filtered )->revenue : 0;
    604                                 $line_item_taxe_breaks    = ! empty( $filtered ) ? reset( $filtered )->taxes : array();
    605 
    606                                 if ( ! empty( $line_item_taxe_breaks ) && is_array( $line_item_taxe_breaks ) ) {
    607                                     foreach ( $line_item_taxe_breaks as $key => $val ) {
    608                                         if ( ! empty( $val->calculationBaseAmt ) && ( $val->calculationBaseAmt >= $line_item_revenue_amount ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
    609                                             $line_item_calc_base_amount      = $val->calculationBaseAmt; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
    610                                             $line_item_recurring_tax_amount += $val->totalTax; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
     600                               
     601                                if ( ! empty( $filtered ) ) {
     602                                    $line_item_revenue_amount = reset( $filtered )->revenue ?? 0;
     603                                    $line_item_taxe_breaks    = reset( $filtered )->taxes ?? array();                               
     604                                   
     605                                    $line_item_calc_base_amount = 0;
     606                                    $line_item_tax_amount       = 0;
     607                                    $retail_delivery_fee_amount = 0;
     608
     609                                    if ( ! empty( $line_item_taxe_breaks ) && is_array( $line_item_taxe_breaks ) ) {
     610                                        foreach ( $line_item_taxe_breaks as $val ) {
     611                                           
     612                                            // Check for Retail Delivery Fee rows
     613                                            if ( isset( $val->taxTypeClassDesc )
     614                                                && strtoupper( $val->taxTypeClassDesc ) === 'RETAIL DELIVERY FEE'
     615                                                && isset( $val->totalTax )
     616                                                && (float) $val->totalTax > 0
     617                                            ) {
     618                                                // Use state-specific fixed amount
     619                                                $state = WC()->customer->get_shipping_state();
     620                                                if ( strtoupper( $state ) === 'CO' ) {
     621                                                    $retail_delivery_fee_amount += $val->rate;
     622                                                   
     623                                                } elseif ( strtoupper( $state ) === 'MN' && $line_item_revenue_amount >= 100 ) {
     624                                                    $retail_delivery_fee_amount += $val->rate;
     625
     626                                                }
     627                                                // do NOT add anything if state is different
     628                                                continue;
     629                                            }
     630
     631                                            // Normal percentage-based taxes, prorated
     632                                            if ( ! empty( $val->calculationBaseAmt ) && ( $val->calculationBaseAmt >= $line_item_revenue_amount ) ) {
     633                                                $line_item_calc_base_amount = (float) $val->calculationBaseAmt;
     634                                                $line_item_tax_amount      += (float) $val->totalTax;
     635                                            }
    611636                                        }
    612637                                    }
    613                                 }
    614                                 if ( ! empty( $line_item_calc_base_amount ) ) {
    615                                     $line_item_total_tax = ( $line_item_revenue_amount / $line_item_calc_base_amount ) * $line_item_recurring_tax_amount;
    616                                     $total_recurring_fee = $total_recurring_fee + $line_item_total_tax;
    617                                     continue;
     638
     639                                    // Pro-rate percentage-based tax
     640                                    $line_item_total_tax = 0;
     641                                    if ( $line_item_calc_base_amount > 0 ) {
     642                                        $line_item_total_tax = ( $line_item_revenue_amount / $line_item_calc_base_amount ) * $line_item_tax_amount;
     643                                    } else {
     644                                        $line_item_total_tax = $line_item_tax_amount;
     645                                    }
     646
     647                                    // Add both prorated taxes + fixed RDF
     648                                    $total_recurring_fee += $line_item_total_tax + $retail_delivery_fee_amount;
     649                                   
    618650                                }
    619651                            }
    620652                        }
    621                         $cart->add_fee( $cere_tax_name, $total_recurring_fee, false );
    622                     }
    623                 } else {
     653                    }
     654               
     655                    //Fallback if nothing matched from Ceretax API
     656                    if ( $total_recurring_fee <= 0 && ! empty( $custom_tax_rate ) ) {
     657                        $total_recurring_fee = $custom_tax_rate;
     658                    }
     659                   
     660                    $cart->add_fee( $cere_tax_name, $total_recurring_fee, false );
     661               
     662                }
     663                else {
     664                    //Normal cart
    624665                    $cart->add_fee( $cere_tax_name, $tax, false );
    625666                }
     667               
    626668            }
    627669        }
     
    13791421            $shipping_charges                         = $order->get_shipping_total();
    13801422            $shipping_zones                           = WC_Shipping_Zones::get_zones();
    1381 
     1423            error_log('inside cwafc_calculate_cere_tax : '.$shipping_charges);
    13821424            // Get order customer id.
    13831425            if ( $order->get_customer_id() ) {
     
    14361478                $product_id              = $item->get_product_id();
    14371479                $product                 = wc_get_product( $product_id );
     1480
     1481                if ( ! $product || ! is_a( $product, 'WC_Product' ) ) {
     1482                    continue; // skip invalid products (manual items, deleted products, etc.)
     1483                }
     1484               
    14381485                $order_item_trial_length = $product->get_meta( '_subscription_trial_length' );
     1486                $item_number             = $product_id;
     1487
     1488                // Check if product is variation.
     1489                if ( $product->is_type( 'variable' ) ) {
     1490                    $item_number = $item->get_variation_id();
     1491                }
    14391492
    14401493                // Get PS code.
     
    14591512                    'lineID'             => (string) $item_id,
    14601513                    'dateOfTransaction'  => gmdate( 'Y-m-d' ),
    1461                     'itemNumber'         => (string) $product_id,
     1514                    'itemNumber'         => (string) $item_number,
    14621515                    'itemDescription'    => esc_html( $product->get_title() ),
    14631516                    'revenue'            => (float) $item->get_total(),
     
    15441597                ),
    15451598            );
     1599            error_log('request body in cwafc_calculate_cere_tax : '.print_r($request_body, true));
    15461600
    15471601            $body = wp_json_encode( $request_body );
     
    17261780            $shipping_charges                         = (float) $refund->get_shipping_total();
    17271781            $shipping_zones                           = WC_Shipping_Zones::get_zones();
    1728 
     1782            error_log('inside cwafc_calculate_cere_tax_refunded'.$shipping_charges);
    17291783            // Get order customer id.
    17301784            if ( $order->get_customer_id() ) {
     
    17691823                $product                 = wc_get_product( $product_id );
    17701824                $order_item_trial_length = $product->get_meta( '_subscription_trial_length' );
     1825                $item_number             = $product_id;
     1826
     1827                // Check if product is variation.
     1828                if ( $product->is_type( 'variable' ) ) {
     1829                    $item_number = $item->get_variation_id();
     1830                }
    17711831
    17721832                // Get PS code.
     
    17931853                    'lineID'             => (string) $item_id,
    17941854                    'dateOfTransaction'  => gmdate( 'Y-m-d' ),
    1795                     'itemNumber'         => (string) $product_id,
     1855                    'itemNumber'         => (string) $item_number,
    17961856                    'itemDescription'    => esc_html( $product->get_title() ),
    17971857                    'revenue'            => $item_total,
     
    18751935                ),
    18761936            );
    1877 
     1937            error_log('request body in cwafc_calculate_cere_tax_refunded : '.print_r($request_body, true));
    18781938            $body = wp_json_encode( $request_body );
    18791939
     
    19902050            $shipping_charges                         = WC()->cart->get_shipping_total();
    19912051            $shipping_zones                           = WC_Shipping_Zones::get_zones();
    1992 
     2052            error_log('inside cwafc_get_tax_rate_from_api : '.$shipping_charges);
    19932053            // Get store address.
    19942054            $store_address         = get_option( 'woocommerce_store_address' );
     
    20282088                    $product                = wc_get_product( $product_id );
    20292089                    $cart_item_trial_length = $product->get_meta( '_subscription_trial_length' );
     2090                    $item_number            = $product_id;
     2091
     2092                    // Check if product is variation.
     2093                    if ( $product->is_type( 'variable' ) ) {
     2094                        $item_number = isset( $cart_item['variation_id'] ) ? $cart_item['variation_id'] : $product_id;
     2095                    }
    20302096
    20312097                    // Get PS code.
     
    20592125                        'lineID'             => $cart_item_id,
    20602126                        'dateOfTransaction'  => gmdate( 'Y-m-d' ),
    2061                         'itemNumber'         => (string) $product_id,
     2127                        'itemNumber'         => (string) $item_number,
    20622128                        'itemDescription'    => esc_html( $product->get_title() ),
    20632129                        'revenue'            => $line_total,
     
    21262192                ),
    21272193            );
    2128 
     2194            error_log('request body in cwafc_get_tax_rate_from_api : '.print_r($request_body, true));
    21292195            $body = wp_json_encode( $request_body );
    21302196
  • ceretax/trunk/readme.txt

    r3320210 r3357953  
    55Tested up to: 6.8.1
    66Requires PHP: 7.4
    7 Stable tag: 1.4.3
     7Stable tag: 1.4.4
    88License: GNU General Public License v3.0
    99URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3535
    3636== Changelog ==
     37
     38= 1.4.4 =
     39* fix - The transactions can be fully refunded
     40* fix - We have resolved the tax amount mismatch in tax total column and summary
     41* fix - Taxes are now displayed for variable items also
    3742
    3843= 1.4.3 =
Note: See TracChangeset for help on using the changeset viewer.