%s', esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=sendelly_pickup' ) ), esc_html__( 'Settings', 'sendelly' ) ) ); return $links; } /** * Declare compatibility with WooCommerce features (HPOS + Blocks checkout). * * @return void */ function sendelly_wc_declare_wc_compatibility() { if ( ! class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { return; } \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', SENDELLY_WC_PLUGIN_FILE, true ); \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', SENDELLY_WC_PLUGIN_FILE, true ); } /** * Boot the plugin once all plugins are loaded. * * Bails out (with an admin notice) when WooCommerce is missing or too old, so * none of the WooCommerce-dependent code is ever required in that case. * * @return void */ function sendelly_wc_init() { if ( ! class_exists( 'WooCommerce' ) || ! defined( 'WC_VERSION' ) || version_compare( WC_VERSION, '7.0', '<' ) ) { add_action( 'admin_notices', 'sendelly_wc_missing_wc_notice' ); return; } require_once SENDELLY_WC_PLUGIN_DIR . 'includes/sendelly-functions.php'; require_once SENDELLY_WC_PLUGIN_DIR . 'includes/class-sendelly-wc-settings.php'; require_once SENDELLY_WC_PLUGIN_DIR . 'includes/class-sendelly-wc-api-client.php'; require_once SENDELLY_WC_PLUGIN_DIR . 'includes/class-sendelly-wc-order-meta.php'; require_once SENDELLY_WC_PLUGIN_DIR . 'includes/class-sendelly-wc-admin.php'; require_once SENDELLY_WC_PLUGIN_DIR . 'includes/class-sendelly-wc-connect.php'; new Sendelly_WC_Order_Meta(); new Sendelly_WC_Connect(); if ( is_admin() ) { new Sendelly_WC_Admin(); } add_action( 'woocommerce_shipping_init', 'sendelly_wc_shipping_init' ); add_filter( 'woocommerce_shipping_methods', 'sendelly_wc_register_shipping_method' ); } /** * Admin notice shown when WooCommerce is missing or older than 7.0. * * @return void */ function sendelly_wc_missing_wc_notice() { if ( ! current_user_can( 'activate_plugins' ) ) { return; } echo '
'; echo esc_html__( 'Sendelly requires WooCommerce 7.0 or newer. Please install or update WooCommerce.', 'sendelly' ); echo '