-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwoocommerce-es.php
More file actions
124 lines (113 loc) · 3.81 KB
/
woocommerce-es.php
File metadata and controls
124 lines (113 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
/**
* Plugin Name: Connect and EU VAT Compliance for WooCommerce
* Plugin URI: https://close.technology/wordpress-plugins/connect-ecommerce/
* Description: Connects Ecommerce WooCommerce to ERPs and CRMs. Syncs products, customers, orders and stock. Includes EU VAT Compliance. Import European Taxes and check VAT compliance.
* Author: Closetechnology
* Author URI: https://close.technology/
* Version: 3.3.3
* Requires PHP: 7.4
* Requires at least: 6.3
* Text Domain: woocommerce-es
* Requires Plugins: woocommerce
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
* Prefix: conecom_
*
* @package WordPress
*/
defined( 'ABSPATH' ) || exit;
define( 'CONECOM_VERSION', '3.3.3' );
define( 'CONECOM_FILE', __FILE__ );
define( 'CONECOM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'CONECOM_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'CONECOM_SYNC_PRODUCTS_PER_BATCH', 50 );
define(
'CONECOM_VAT_FIELD_SLUGS',
array(
'_billing_vat',
'_billing_nif',
'_billing_vat_number',
'billing_vat',
'_wc_shipping/connect_ecommerce/billing_vat', // Gutenberg compatibility.
'VAT Number',
)
);
require_once CONECOM_PLUGIN_PATH . 'vendor/autoload.php';
/**
* Gets the options for the plugin.
*
* @return array
*/
function conecom_get_options() {
/**
* Default values
*/
global $wpdb;
return apply_filters(
'conecom_options_plugin',
array(
'clientify' => array(
'name' => 'Clientify',
'slug' => 'conecom-clientify',
'version' => CONECOM_VERSION,
'plugin_name' => 'Connect WooCommerce Clientify',
'plugin_slug' => 'connect-ecommerce-clientify',
'disable_modules' => array( 'subscription' ),
'api_pagination' => 100,
'product_price_tax_option' => true,
'product_price_rate_option' => false,
'product_option_stock' => false,
'order_send_attachments' => true,
'order_sync_partial' => true,
'order_import_free_order' => true,
'order_only_order_completed' => 'completed',
'settings_logo' => CONECOM_PLUGIN_URL . 'includes/Connector/assets/logo.svg',
'settings_admin_message' => sprintf(
// translators: %s url of contact.
__( 'Put the connection API key settings in order to connect and sync products. You can go here <a href = "%s" target = "_blank">App Test API</a>.', 'woocommerce-es' ),
'https://app.test.com/api'
),
'settings_special_tabs' => array(),
'settings_fields' => array( 'apipassword' ),
'table_sync' => $wpdb->prefix . 'sync_conecom-clientify',
'file' => __FILE__,
),
)
);
}
add_action( 'init', 'conecom_loads' );
/**
* Connect WooCommerce loads.
*
* @return void
*/
function conecom_loads() {
require_once CONECOM_PLUGIN_PATH . 'includes/Plugin_Main.php';
require_once CONECOM_PLUGIN_PATH . 'includes/Connector/class-api-clientify.php';
$conecom_options = conecom_get_options();
new CLOSE\ConnectEcommerce\Base( $conecom_options );
}
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once CONECOM_PLUGIN_PATH . 'includes/CLI/Import_Products_Command.php';
/**
* Registers our command when cli get's initialized.
*
* @since 1.0.0
* @author David Perez
*/
function conecom_import_products_register_commands() {
WP_CLI::add_command( 'conecom', 'Import_Products_Command' );
}
add_action( 'cli_init', 'conecom_import_products_register_commands', 20 );
}
register_activation_hook( __FILE__, 'conecom_move_settings' );
/**
* Move settings from old plugin to new plugin
*
* @return void
*/
function conecom_move_settings() {
CLOSE\ConnectEcommerce\Helpers\HELPER::move_settings();
}