小编mic*_*s90的帖子

自定义运输方式插件中的 WooCommerce 运输成本计算

我正在尝试为 WooCommerce 创建一个插件,根据产品重量计算运费。我不断收到此错误:

\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

这是我的整个插件:

\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)

php methods wordpress woocommerce shipping-method

4
推荐指数
1
解决办法
2729
查看次数

标签 统计

methods ×1

php ×1

shipping-method ×1

woocommerce ×1

wordpress ×1