Plugin Directory

Changeset 3243455


Ignore:
Timestamp:
02/19/2025 07:01:18 PM (14 months ago)
Author:
ceretax
Message:

Woo Commerce Release V1.3.6

Location:
ceretax/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ceretax/trunk/ceretax.php

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

    r3238165 r3243455  
    3131 * add - Refunded order tax calculation in ceretax
    3232
    33 2025-02-08- version 1.3.5
    34  * fix - Avalara AvaTax order subscription renewal order issue
     332025-02-19 - version 1.3.6
     34 * fix - * fix - If fee name changed from admin option, destroy order calculation issue
  • ceretax/trunk/inc/class-cwafc.php

    r3238165 r3243455  
    102102            add_filter( 'woocommerce_cart_totals_taxes_total_html', '__return_empty_string' );
    103103            add_filter( 'woocommerce_get_order_item_totals', array( $this, 'action__cwafc_remove_tax_line_checkout' ), 10 );
     104            // Modify the fee name dynamically when orders are loaded.
     105            add_filter( 'woocommerce_order_get_items', array( $this, 'filter__cwafc_modify_fee_name_dynamically' ), 10, 2 );
    104106        }
    105107
     
    823825            $order_contains_renewal     = ( function_exists( 'wcs_order_contains_renewal' ) ) ? wcs_order_contains_renewal( $order_id ) : true;
    824826            // Check if order have other tax system.
    825             if ( empty( $order_ceretax_data ) && ! empty( $order_avatax_data ) && ! $order_contains_renewal ) {
     827            if ( empty( $order_ceretax_data ) && ! empty( $order_avatax_data ) ) {
    826828                return false;
    827829            }
     
    899901            // Check if order have other tax system.
    900902            if ( empty( $order_ceretax_data ) && ! empty( $order_avatax_data ) && ! $order_contains_renewal ) {
    901                 return false;
     903                return $renewal_order;
    902904            }
    903905            if ( 'yes' !== $cere_tax_post_transactions ) {
    904                 return false;
     906                return $renewal_order;
    905907            }
    906908
     
    975977            $order_contains_renewal     = ( function_exists( 'wcs_order_contains_renewal' ) ) ? wcs_order_contains_renewal( $order->get_id() ) : true;
    976978            // Check if order have other tax system.
    977             if ( empty( $order_ceretax_data ) && ! empty( $order_avatax_data ) && ! $order_contains_renewal ) {
     979            if ( empty( $order_ceretax_data ) && ! empty( $order_avatax_data ) ) {
    978980                return false;
    979981            }
     
    10331035                    $order->add_item( $item_fee );
    10341036                }
    1035                 $order->update_meta_data( 'ceretax', '56' );
    10361037                // Set the transient to prevent recursion.
    10371038                set_transient( 'prevent_order_calculate_totals', true, 10 );
     
    12891290                $this->cwafc_wc_add_custom_logs( $request_body, 'ceretax-api-request' );
    12901291            }
     1292            // Update tax name in order meta.
     1293            update_post_meta( $order->get_id(), 'ceretax_tax_name', get_option( CWAFC_PREFIX . '_cere_tax_name', 'Tax' ) );
    12911294
    12921295            $ceretax_stau = get_post_meta( $order->get_id(), 'ceretax_stau_' . $order->get_id(), true );
     
    19241927        }
    19251928
     1929        /**
     1930         * Modify fee name dynamically.
     1931         *
     1932         * @param object $items Order item object.
     1933         * @param object $order Order object.
     1934         * @return $items
     1935         */
     1936        public function filter__cwafc_modify_fee_name_dynamically( $items, $order ) {
     1937            $cere_tax_name      = get_option( CWAFC_PREFIX . '_cere_tax_name', 'Tax' );
     1938            $order_ceretax_name = get_post_meta( $order->get_id(), 'ceretax_tax_name', true );
     1939            $ceretax_data       = get_post_meta( $order->get_id(), 'ceretax_data', true );
     1940
     1941            if ( ! empty( $ceretax_data ) ) {
     1942                foreach ( $items as $item_id => $item ) {
     1943                    if ( $item->is_type( 'fee' ) && $item->get_name() === $order_ceretax_name ) {
     1944                        // Update tax name in order meta.
     1945                        update_post_meta( $order->get_id(), 'ceretax_tax_name', $cere_tax_name );
     1946                        $item->set_name( $cere_tax_name ); // Override fee name dynamically.
     1947                        $item->save();
     1948                    }
     1949                }
     1950            }
     1951            return $items;
     1952        }
    19261953    }
    19271954}
  • ceretax/trunk/readme.txt

    r3238165 r3243455  
    55Tested up to: 6.6.1
    66Requires PHP: 7.4
    7 Stable tag: 1.3.5
     7Stable tag: 1.3.6
    88License: GNU General Public License v3.0
    99URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3636== Changelog ==
    3737
    38 = 1.3.5 =
    39 * fix - Avalara AvaTax order subscription renewal order issue
     38= 1.3.6 =
     39* fix - If fee name changed from admin option, destroy order calculation issue
    4040
    4141= 1.3.4 =
     
    7171== Upgrade Notice ==
    7272
    73 = 1.3.5 =
    74 * fix - Avalara AvaTax order subscription renewal order issue
     73= 1.3.6 =
     74* fix - If fee name changed from admin option, destroy order calculation issue
    7575
    7676= 1.3.4 =
Note: See TracChangeset for help on using the changeset viewer.