我正在尝试为 WooCommerce 创建一个插件,根据产品重量计算运费。我不断收到此错误:
\n\n\n\n\n警告: WC_Your_Shipping_Method::calculate_shipping($package) 的声明应与 C:\\Users\\Michelle\\Dropbox\\MEDIEINSTITUTET\\Utveckling mot e-handel\\ 中的 WC_Shipping_Method::calculate_shipping($package = Array) 兼容WooCommerce\\WC-kurs\\wp-content\\plugins\\frakt\\frakt.php 第 18 行
\n
这是我的整个插件:
\n\n<?php \n/* *\n* Plugin Name: Min frakt modul\n Description: Ett plugin som ber\xc3\xa4knar frakt kostnad beroende p\xc3\xa5 vikten\n*/\n\n/**\n * Check if WooCommerce is active\n */\n\nif (!defined(\'ABSPATH\')) {\n exit;\n}\n\nif ( in_array( \'woocommerce/woocommerce.php\', apply_filters( \'active_plugins\', get_option( \'active_plugins\' ) ) ) ) {\n function your_shipping_method_init() {\n if ( ! class_exists( \'WC_Your_Shipping_Method\' ) ) {\n class WC_Your_Shipping_Method extends WC_Shipping_Method {\n /**\n …Run Code Online (Sandbox Code Playgroud)