feat: Migrate to Google Merchant API and remove Composer dependencies

- Fix ISE 500 error on plugin activation:
  - Defer wc_get_logger() call in Logger class (lazy initialization)
  - Move plugin init to plugins_loaded hook with priority 20
  - Remove invalid Google_Service_ShoppingContent_Reports instantiation

- Migrate from deprecated Content API to new Merchant API:
  - Rewrite Google API class with direct REST calls
  - Implement JWT authentication using PHP OpenSSL
  - Use WordPress wp_remote_* functions for HTTP requests
  - Support Price Competitiveness reports for competitor pricing

- Remove all Composer dependencies:
  - Delete vendor/ directory (~50 packages)
  - Delete composer.json and composer.lock
  - Remove setup scripts and related documentation

- Plugin is now fully self-contained with no external dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-21 08:29:25 +01:00
parent 366352fb14
commit d1f3607895
32462 changed files with 344 additions and 4063131 deletions

View File

@@ -3,7 +3,7 @@
* Plugin Name: informatiq-smart-google-pricing
* Plugin URI: https://informatiq.services
* Description: Automatically adjusts WooCommerce sale prices based on Google Merchant Center competitor data.
* Version: 1.0.0
* Version: 2.0.0
* Author: Mălin Cenușă
* Author URI: https://malin.ro
* Text Domain: informatiq-smart-pricing
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Define plugin constants.
define( 'INFORMATIQ_SP_VERSION', '1.0.0' );
define( 'INFORMATIQ_SP_VERSION', '2.0.0' );
define( 'INFORMATIQ_SP_PLUGIN_FILE', __FILE__ );
define( 'INFORMATIQ_SP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'INFORMATIQ_SP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -82,8 +82,11 @@ class Informatiq_Smart_Google_Pricing {
return;
}
// Load autoloader.
require_once INFORMATIQ_SP_PLUGIN_DIR . 'vendor/autoload.php';
// Check for OpenSSL extension (required for JWT signing).
if ( ! extension_loaded( 'openssl' ) ) {
add_action( 'admin_notices', array( $this, 'openssl_missing_notice' ) );
return;
}
// Load plugin classes.
$this->includes();
@@ -116,6 +119,17 @@ class Informatiq_Smart_Google_Pricing {
<?php
}
/**
* OpenSSL missing notice.
*/
public function openssl_missing_notice() {
?>
<div class="notice notice-error">
<p><?php esc_html_e( 'Informatiq Smart Google Pricing requires the PHP OpenSSL extension for Google API authentication.', 'informatiq-smart-pricing' ); ?></p>
</div>
<?php
}
/**
* Include required files.
*/
@@ -190,5 +204,11 @@ function informatiq_sp() {
return Informatiq_Smart_Google_Pricing::instance();
}
// Initialize plugin.
informatiq_sp();
/**
* Initialize plugin after all plugins are loaded.
* This ensures WooCommerce functions are available.
*/
function informatiq_sp_init() {
informatiq_sp();
}
add_action( 'plugins_loaded', 'informatiq_sp_init', 20 );