Plugin Directory

Changeset 3245884


Ignore:
Timestamp:
02/24/2025 04:37:53 PM (13 months ago)
Author:
ceretax
Message:

CereTax Woo Plugin V1.3.7 Release

1.3.7

  • fix - If the tax showing zero in order calculation issue
Location:
ceretax/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ceretax/trunk/ceretax.php

    r3243455 r3245884  
    44 * Plugin URI: https://wordpress.org/plugins/ceretax/
    55 * Description: Simplify sales tax complexity with CereTax for WooCommerce.
    6  * Version: 1.3.6
     6 * Version: 1.3.7
    77 * Author: CereTax, Inc.
    88 * Author URI: https://www.ceretax.com/
  • ceretax/trunk/changelog.txt

    r3243455 r3245884  
    33332025-02-19 - version 1.3.6
    3434 * fix - * fix - If fee name changed from admin option, destroy order calculation issue
     35
     362025-02-24 - version 1.3.7
     37* fix - If the tax showing zero in order calculation issue
  • ceretax/trunk/inc/admin/class-cwafc-admin-action.php

    r3232301 r3245884  
    389389         */
    390390        public function action__cwafc_admin_footer_function() {
    391 
     391            $order_id = null;
    392392            if ( ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) || ( isset( $_GET['id'] ) && ! empty( $_GET['id'] ) ) ) {
    393393                if ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) {
  • ceretax/trunk/inc/class-cwafc.php

    r3243455 r3245884  
    115115
    116116            $ceretax_data = get_post_meta( $order_id, 'ceretax_data', true );
    117             if ( empty( $ceretax_data ) ) {
     117
     118            // If it's empty or an invalid JSON string, return early.
     119            if ( empty( $ceretax_data ) || ! is_string( $ceretax_data ) || json_decode( $ceretax_data ) === null ) {
    118120                return;
    119121            }
    120             $ceretax_data      = json_decode( $ceretax_data );
     122            $ceretax_data = json_decode( $ceretax_data );
     123
     124            // Ensure decoding is successful and required property exists.
     125            if ( ! $ceretax_data || ! isset( $ceretax_data->invoice->totalTaxInvoice ) ) {
     126                return;
     127            }
     128
    121129            $cere_tax_name     = get_option( CWAFC_PREFIX . '_cere_tax_name', 'Tax' );
    122130            $total_tax_invoice = abs( $ceretax_data->invoice->totalTaxInvoice );
    123 
    124131            $order             = wc_get_order( $order_id );
    125132            $fee_amount        = null;
    126133            $order_total_fees  = $order->get_total_fees();
    127134            $order_remain_fees = 0;
     135
    128136            foreach ( $order->get_fees() as $fee_id => $fee ) {
    129137                if ( $fee->get_name() === $cere_tax_name ) {
     
    136144                }
    137145            }
    138 
    139146            if ( 0 < $order_remain_fees ) {
    140147                echo '<tr>';
     
    747754        public function action__cwafc_checkout_field_update_order_meta( $order_id ) {
    748755            $ceretax_data = WC()->session->get( 'ceretax_data' );
    749             update_post_meta( $order_id, 'ceretax_data', wp_json_encode( $ceretax_data ) );
     756            if ( ! empty( $ceretax_data ) ) {
     757                update_post_meta( $order_id, 'ceretax_data', wp_json_encode( $ceretax_data ) );
     758            }
    750759        }
    751760
     
    13331342                    }
    13341343                    update_post_meta( $order->get_id(), 'ceretax_data', wp_json_encode( $data ) );
     1344                    WC()->session->set( 'ceretax_data', $data );
    13351345                    return $data['invoice']['totalTaxInvoice'];
    13361346                }
     
    13721382                    }
    13731383                    update_post_meta( $order->get_id(), 'ceretax_data', wp_json_encode( $data ) );
     1384                    WC()->session->set( 'ceretax_data', $data );
    13741385                    return $data['invoice']['totalTaxInvoice'];
    13751386                }
  • ceretax/trunk/readme.txt

    r3243455 r3245884  
    55Tested up to: 6.6.1
    66Requires PHP: 7.4
    7 Stable tag: 1.3.6
     7Stable tag: 1.3.7
    88License: GNU General Public License v3.0
    99URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3535
    3636== Changelog ==
     37
     38= 1.3.7 =
     39* fix - If the tax showing zero in order calculation issue
    3740
    3841= 1.3.6 =
     
    7174== Upgrade Notice ==
    7275
     76= 1.3.7 =
     77* fix - If the tax showing zero in order calculation issue
     78
    7379= 1.3.6 =
    7480* fix - If fee name changed from admin option, destroy order calculation issue
Note: See TracChangeset for help on using the changeset viewer.