Changeset 3219747
- Timestamp:
- 01/09/2025 04:23:59 PM (15 months ago)
- Location:
- ceretax/trunk
- Files:
-
- 5 edited
-
ceretax.php (modified) (2 diffs)
-
changelog.txt (modified) (1 diff)
-
inc/admin/class-cwafc-admin-action.php (modified) (2 diffs)
-
inc/class-cwafc.php (modified) (10 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ceretax/trunk/ceretax.php
r3165281 r3219747 2 2 /** 3 3 * Plugin Name: CereTax 4 * Plugin URI: https://wo ocommerce.com/products/woocommerce-ceretax/4 * Plugin URI: https://wordpress.org/plugins/ceretax/ 5 5 * Description: Simplify sales tax complexity with CereTax for WooCommerce. 6 * Version: 1. 2.06 * Version: 1.3.0 7 7 * Author: CereTax, Inc. 8 8 * Author URI: https://www.ceretax.com/ … … 39 39 // Version of plugin. 40 40 if ( ! defined( 'CWAFC_VERSION' ) ) { 41 define( 'CWAFC_VERSION', '1. 0.0' );41 define( 'CWAFC_VERSION', '1.3.0' ); 42 42 } 43 43 -
ceretax/trunk/changelog.txt
r3165281 r3219747 1 1 *** Ceretax *** 2 2 3 2024-10-0 7- version 1.2.03 2024-10-08 - version 1.2.0 4 4 * First Release. 5 6 2024-10-19 - version 1.2.1 7 * Fix fees related text in admin side. 8 9 2024-12-15 - version 1.2.2 10 * Fix - fees and tax fatal errors 11 * Fix - fees and tax display errors. 12 13 2024-12-31 - version 1.3.0 14 * add - Partial payment behavior for delivery fee 15 * add - Trial order (0 value order) payment with shipping amount 16 * add - Subscription and Renewal orders with shipping and it's payment behavior -
ceretax/trunk/inc/admin/class-cwafc-admin-action.php
r3165281 r3219747 42 42 add_action( 'created_product_cat', array( $this, 'action__cwafc_save_custom_field_in_product_category' ), 10, 2 ); 43 43 add_action( 'edited_product_cat', array( $this, 'action__cwafc_save_custom_field_in_product_category' ), 10, 2 ); 44 add_action( 'admin_footer', array( $this, 'action__cwafc_admin_footer_function' ), 20 ); 44 45 } 45 46 … … 371 372 // phpcs:enable WordPress.Security.NonceVerification.Missing 372 373 } 374 375 /** 376 * Admin footer style 377 * 378 * @return void 379 */ 380 public function action__cwafc_admin_footer_function() { 381 ?> 382 <style> 383 /* Hide the 3rd tr of .wc-order-totals if .wc-used-coupons is found */ 384 .wc-order-data-row:has(.wc-used-coupons) .wc-order-totals:first-of-type tr:nth-of-type(3) { 385 display: none !important; 386 } 387 388 /* Hide the 2nd tr of .wc-order-totals if .wc-used-coupons is not found */ 389 .wc-order-data-row:not(:has(.wc-used-coupons)) .wc-order-totals:first-of-type tr:nth-of-type(2) { 390 display: none !important; 391 } 392 393 </style> 394 <?php 395 } 373 396 } 374 397 -
ceretax/trunk/inc/class-cwafc.php
r3165281 r3219747 80 80 // Apply the tax/fee. 81 81 add_action( 'woocommerce_cart_calculate_fees', array( $this, 'action__cwafc_apply_custom_tax_rate' ) ); 82 add_action( 'woocommerce_admin_order_totals_after_tax', array( $this, 'action__cwafc_add_custom_item_order_admin' ) ); 82 83 // Add address validation button on checkout page. 83 84 add_action( 'woocommerce_before_order_notes', array( $this, 'action__cwafc_add_address_validate_button' ) ); … … 96 97 // Allow woocommerce subscriptions to add recurring fee. 97 98 add_filter( 'woocommerce_subscriptions_is_recurring_fee', '__return_true' ); 99 } 100 101 /** 102 * Show order caclulation 103 * 104 * @param string $order_id Order ID. 105 * @return void 106 */ 107 public function action__cwafc_add_custom_item_order_admin( $order_id ) { 108 109 $ceretax_data = get_post_meta( $order_id, 'ceretax_data', true ); 110 $ceretax_data = json_decode( $ceretax_data ); 111 112 $total_tax_invoice = $ceretax_data->invoice->totalTaxInvoice; 113 114 115 $order = wc_get_order( $order_id ); 116 $fee_amount = null; 117 $order_total_fees = $order->get_total_fees(); 118 $order_remain_fees = 0; 119 foreach ( $order->get_fees() as $fee_id => $fee ) { 120 if ( $fee->get_name() === 'Tax' ) { 121 $fee_amount = $fee->get_amount(); 122 if ( is_numeric( $order_total_fees ) && is_numeric( $fee_amount ) ) { 123 $order_remain_fees = (float) $order_total_fees - (float) $fee_amount; 124 } 125 $fee->save(); 126 break; 127 } 128 } 129 130 if ( 0 < $order_remain_fees ) { 131 echo '<tr>'; 132 echo '<td class="label">' . __( 'Fees', 'ceretax' ) . ':</td>'; 133 echo '<td width="1%"></td>'; 134 echo '<td class="total">' . wc_price( $order_remain_fees ) . '</td>'; 135 echo '</tr>'; 136 } 137 echo '<tr>'; 138 echo '<td class="label">' . __( 'Tax', 'ceretax' ) . ':</td>'; 139 echo '<td width="1%"></td>'; 140 echo '<td class="total">' . wc_price( $total_tax_invoice ) . '</td>'; 141 echo '</tr>'; 98 142 } 99 143 … … 897 941 */ 898 942 public function action__cwafc_order_after_calculate_totals( $and_taxes, $order ) { 899 900 943 $cere_tax_post_transactions = get_option( CWAFC_PREFIX . '_cere_tax_post_transactions' ); 901 944 if ( 'yes' !== $cere_tax_post_transactions ) { 902 945 return false; 903 946 } 904 905 947 // Prevent infinite loop using a transient or custom flag. 906 948 if ( get_transient( 'prevent_order_calculate_totals' ) ) { 907 949 return; 908 950 } 909 910 951 $shipping_address_1 = $order->get_shipping_address_1(); 911 952 if ( ! empty( $shipping_address_1 ) ) { … … 952 993 $order->add_item( $item_fee ); 953 994 } 954 995 $order->update_meta_data( 'ceretax', '56' ); 955 996 // Set the transient to prevent recursion. 956 997 set_transient( 'prevent_order_calculate_totals', true, 10 ); … … 1012 1053 $api_url = 'https://calc.cert.ceretax.net/sale'; 1013 1054 } 1055 1056 $item_count = 0; 1057 $order_status = $order->get_status(); 1058 $created_via = $order->get_meta( '_created_via' ); 1059 $order_parent_id = $order->get_parent_id(); 1060 $order_type = $order->get_type(); 1061 1014 1062 foreach ( $order->get_items() as $item_id => $item ) { 1015 $product_id = $item->get_product_id(); 1016 $product = wc_get_product( $product_id ); 1063 1064 $product_id = $item->get_product_id(); 1065 $product = wc_get_product( $product_id ); 1066 $order_item_trial_length = $product->get_meta( '_subscription_trial_length' ); 1017 1067 1018 1068 // Get PS code. … … 1034 1084 } 1035 1085 1036 $line_items[ ] = array(1086 $line_items[ $item_count ] = array( 1037 1087 'lineID' => (string) $item_id, 1038 1088 'dateOfTransaction' => gmdate( 'Y-m-d' ), … … 1058 1108 ), 1059 1109 ); 1110 1111 $this->cwafc_wc_add_custom_logs( array( 'order_id' => $order->get_id(), '$order_parent_id' => $order_parent_id, 'order_type' => $order_type, 'order_item_trial_length' => $order_item_trial_length, 'created_via' => $created_via, 'order_status' => $order_status ), 'ceretax-api-TEST' ); 1112 1113 // Check if deposit and scheduled orders. 1114 if ( ! empty( $order_parent_id ) && 'wc_deposits' === $created_via && 'scheduled-payment' === $order_status ) { 1115 $line_items[ $item_count ]['attributes'] = array( 1116 array( 1117 'key' => 'noDeliveryFee', 1118 'value' => 'Y', 1119 ), 1120 ); 1121 } 1122 1123 // Check if subscription trial main order. 1124 if ( empty( $order_parent_id ) && 'subscription' !== $created_via && ! empty( $order_item_trial_length ) ) { 1125 $line_items[ $item_count ]['attributes'] = array( 1126 array( 1127 'key' => 'noDeliveryFee', 1128 'value' => 'Y', 1129 ), 1130 ); 1131 } 1132 $item_count++; 1060 1133 } 1061 1134 … … 1268 1341 1269 1342 if ( ! WC()->cart->is_empty() ) { 1343 $item_count = 0; 1270 1344 foreach ( WC()->cart->get_cart() as $cart_item_id => $cart_item ) { 1271 $product_id = $cart_item['product_id']; 1272 $product = wc_get_product( $product_id ); 1345 $product_id = $cart_item['product_id']; 1346 $product = wc_get_product( $product_id ); 1347 $cart_item_trial_length = $product->get_meta( '_subscription_trial_length' ); 1273 1348 1274 1349 // Get PS code. … … 1299 1374 $invoice_total_amount += $line_total; 1300 1375 1301 $cart_items[ ] = array(1376 $cart_items[ $item_count ] = array( 1302 1377 'lineID' => $cart_item_id, 1303 1378 'dateOfTransaction' => gmdate( 'Y-m-d' ), … … 1323 1398 ), 1324 1399 ); 1400 1401 // Check if subscription trial main order. 1402 if ( ! empty( $cart_item_trial_length ) ) { 1403 $cart_items[ $item_count ]['attributes'] = array( 1404 array( 1405 'key' => 'noDeliveryFee', 1406 'value' => 'Y', 1407 ), 1408 ); 1409 } 1410 $item_count++; 1411 1325 1412 } 1326 1413 } -
ceretax/trunk/readme.txt
r3179144 r3219747 5 5 Tested up to: 6.6.1 6 6 Requires PHP: 5.6 7 Stable tag: 1. 2.07 Stable tag: 1.3.0 8 8 License: GNU General Public License v3.0 9 9 URI: http://www.gnu.org/licenses/gpl-3.0.html … … 17 17 CereTax's all-in-one sales tax solution seamlessly integrates into WooCommerce, automating sales tax on your orders. Utilizing countless technological advancements, CereTax was engineered in a way that truly revolutionizes the way a tax calculation platform operates, focusing on speed, dependability, scalability, accuracy, and customization. With CereTax, you'll have confidence that your business has the tools to: 18 18 19 * Collect the correct sales taxes everywhere you do business .20 * Stay in compliance and be audit ready .21 * Easily track and report advanced analytics .22 * Grow painlessly as you add new products, add new markets, and acquire companies .23 * Always get the answers when you need them with world-class support .19 * Collect the correct sales taxes everywhere you do business 20 * Stay in compliance and be audit ready 21 * Easily track and report advanced analytics 22 * Grow painlessly as you add new products, add new markets, and acquire companies 23 * Always get the answers when you need them with world-class support 24 24 25 25 = CereTax Features = 26 26 27 27 * Real-time Sales Tax Calculations: CereTax automatically calculates sales tax on your orders based on location, product, and service taxability. 28 * Precise Tax Assignments: Pinpoint accuracy with our industry first, proprietary GIS method -even for remote locations!28 * Precise Tax Assignments: Pinpoint accuracy with our industry first, proprietary GIS method – even for remote locations! 29 29 * Reports and Analytics: Deep, actionable analytics for your entire enterprise through one User Interface. Link business units and sales channels all through one unified platform. 30 30 * Audit Tools: Be prepared at all times with on-demand detailed reporting down to the transaction level and explanations for taxability decisions, along with statute and citation references are available at a transaction level right through the UI. 31 32 = Pricing =33 * The CereTax plugin requires a subscription to CereTax's tax calculation service. [Reach out to CereTax](https://www.ceretax.com/contact) today to get started!34 31 35 32 == Installation == … … 39 36 == Changelog == 40 37 38 = 1.3.0 = 39 * add - Partial payment behavior for delivery fee 40 * add - Trial order (0 value order) payment with shipping amount 41 * add - Subscription and Renewal orders with shipping and it's payment behavior 42 43 = 1.2.2 = 44 * Fix - fees and tax fatal errors 45 * Fix - fees and tax display errors 46 47 = 1.2.1 = 48 * Fix - fees related text in admin side 49 41 50 = 1.2.0 = 42 51 * Initial Release … … 44 53 == Upgrade Notice == 45 54 55 = 1.3.0 = 56 1.3.0 is fix - fees related text in admin side 57 46 58 = 1.2.0 = 47 59 1.2.0 is Initial Release.
Note: See TracChangeset
for help on using the changeset viewer.