Partnercenter-API: WooCommerce-Plugin (v1.3.3) als Referenz eingecheckt
Der in den Partner-Shops installierte WooCommerce-Connector, der Bestellungen per REST an /api/wp/* uebertraegt (Kunde anlegen, Warenkorb, Status-Abgleich). Grundlage fuer AP-13 (Shop-Bestandsabzug beim Versand). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
a14751ed10
commit
592b03ace5
13 changed files with 2023 additions and 0 deletions
103
dev/partnercenter-api/partnercenter-api.php
Normal file
103
dev/partnercenter-api/partnercenter-api.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Name: PARTNERCENTER API Connector
|
||||
* Description: Connect WooCommerce to PARTNERCENTER API
|
||||
* Version: 1.3.3
|
||||
* Author: Cross Media Cloud
|
||||
* Author URI: https://www.cross-media-cloud.de
|
||||
* License: GNU General Public License v2 or later
|
||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Text Domain: partnercenter-api
|
||||
* Domain Path: /languages/
|
||||
*/
|
||||
if (! defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load plugin text domain
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function partnercenter_api_load_textdomain()
|
||||
{
|
||||
|
||||
load_plugin_textdomain('partnercenter-api', false, plugin_basename(dirname(__FILE__)).'/languages');
|
||||
|
||||
}
|
||||
add_action('plugins_loaded', 'partnercenter_api_load_textdomain');
|
||||
|
||||
/**
|
||||
* Function to run after plugin activation
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function partnercenter_api_activate()
|
||||
{
|
||||
|
||||
// Add event to wp cron
|
||||
wp_schedule_event(time(), 'hourly', 'partnercenter_api_fetch_orders_status');
|
||||
|
||||
}
|
||||
register_activation_hook(__FILE__, 'partnercenter_api_activate');
|
||||
|
||||
/**
|
||||
* Function to run after plugin deactivation
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function partnercenter_api_deactivate()
|
||||
{
|
||||
|
||||
/*
|
||||
* Remove order status check from wp cron
|
||||
*/
|
||||
$timestamp = wp_next_scheduled('partnercenter_api_fetch_orders_status');
|
||||
wp_unschedule_event($timestamp, 'partnercenter_api_fetch_orders_status');
|
||||
// Clean hook
|
||||
wp_clear_scheduled_hook('partnercenter_api_fetch_orders_status');
|
||||
|
||||
}
|
||||
register_deactivation_hook(__FILE__, 'partnercenter_api_deactivate');
|
||||
|
||||
/**
|
||||
* Load API class if needed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function partnercenter_api_init()
|
||||
{
|
||||
|
||||
/**
|
||||
* Load the API class.
|
||||
*/
|
||||
require_once plugin_dir_path(__FILE__).'public/partnercenter-api/partnercenter-api.php';
|
||||
|
||||
return new PARTNERCENTER_API_Requests;
|
||||
|
||||
}
|
||||
add_filter('PARTNERCENTER_API', 'partnercenter_api_init');
|
||||
|
||||
/*
|
||||
* Load all public features.
|
||||
*/
|
||||
// Load testing short code
|
||||
require_once 'public/shortcode.php';
|
||||
// Load WooCommerce status related features
|
||||
require_once 'public/woocommerce/order-status.php';
|
||||
// Load endpoint
|
||||
require_once 'public/end-point.php';
|
||||
|
||||
/*
|
||||
* Load admin features.
|
||||
*/
|
||||
if (is_admin()) {
|
||||
|
||||
// Load post list features
|
||||
require_once 'admin/post-list.php';
|
||||
|
||||
// Load button to forward order to fulfilment by PARTNERCENTER
|
||||
require_once 'admin/order-forwarding-button-metabox.php';
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue