Skip to content

Commit

Permalink
Added filter wc_siigo_integration_state_code
Browse files Browse the repository at this point in the history
Added filter wc_siigo_integration_city_code
Added filter wc_siigo_integration_address
  • Loading branch information
Saul Morales committed Sep 17, 2024
1 parent e8ba2cd commit 8a109eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion includes/class-integration-siigo-wc.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ public static function generate_invoice($order_id, $previous_status, $next_statu
$city = $order->get_billing_city() ?: $order->get_shipping_city();
$states_dane = include(dirname(__FILE__) . '/states-dane.php');
$state_code = $states_dane[$state] ?? null;
$state_code = apply_filters('wc_siigo_integration_state_code', $state_code);
$city_code = self::get_code_city($state, $city);
$city_code = apply_filters('wc_siigo_integration_city_code', $city_code);
$address = $order->get_billing_address_1() ?: $order->get_shipping_address_1();
$address = apply_filters('wc_siigo_integration_address', $address);

if(!$state_code) throw new Exception('Departamento no encontrado');
if(!$city_code) throw new Exception('Ciudad no encontrada');
Expand Down Expand Up @@ -230,7 +234,7 @@ public static function generate_invoice($order_id, $previous_status, $next_statu
]
],
"address" => [
"address" => $order->get_billing_address_1() ?: $order->get_shipping_address_1(),
"address" => $address,
"city" => [
"country_code" => $order->get_billing_country() ?: $order->get_shipping_country(),
"state_code" => $state_code,
Expand Down
4 changes: 2 additions & 2 deletions integration-siigo-woo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Integration Siigo Woocommerce
* Description: Integración del sistama contable y de facturación Siigo para Woocoommerce
* Version: 0.0.14
* Version: 0.0.15
* Author: Saul Morales Pacheco
* Author URI: https://saulmoralespa.com
* License: GNU General Public License v3.0
Expand All @@ -17,7 +17,7 @@
}

if(!defined('INTEGRATION_SIIGO_WC_SMP_VERSION')){
define('INTEGRATION_SIIGO_WC_SMP_VERSION', '0.0.14');
define('INTEGRATION_SIIGO_WC_SMP_VERSION', '0.0.15');
}

add_action( 'plugins_loaded', 'integration_siigo_wc_smp_init');
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: commerce, e-commerce, commerce, WordPress ecommerce, store, sales, sell, s
Requires at least: 6.0
Tested up to: 6.6.1
Requires PHP: 8.1
Stable tag: 0.0.14
Stable tag: 0.0.15
License: GNU General Public License v3.0
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down

0 comments on commit 8a109eb

Please sign in to comment.