小编jho*_*101的帖子

如何在WooCommerce 3中添加自定义工作运输方法

我已经成功创建了一种新的运输方式,并为其提供了对运输区域的支持.但是,当我从下拉列表中选择方法将其添加到区域时,它不会出现在"选定的方法列表"中.

我录制了一个截屏gif来演示:

截屏gif

我不能为我的生活弄清楚为什么它不起作用.如果我选择其中一种标准方法(Screencast GIF),它可以正常工作

任何人都知道这里发生了什么以及如何让它发挥作用?

这是我在这个官方帖子中提供的代码: Shipping Method API:

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

    function request_a_shipping_quote_init() {
        if ( ! class_exists( 'WC_Request_Shipping_Quote_Method' ) ) {
            class WC_Request_Shipping_Quote_Method extends WC_Shipping_Method {
                /**
                 * Constructor for your shipping class
                 *
                 * @access public
                 * @return void
                 */
                public function __construct() {
                    $this->id                 = 'request_a_shipping_quote'; // Id for your shipping method. Should be uunique.
                    $this->method_title       = __( …
Run Code Online (Sandbox Code Playgroud)

php wordpress shipping extending woocommerce

8
推荐指数
3
解决办法
7523
查看次数

在 WooCommerce 中更改特定付款方式的结帐提交按钮文本

我需要更改order_button_text特定支付网关(在这种情况下为 COD)。

我只能使用以下方法使其全局更改(对于所有支付网关):

add_action( 'woocommerce_after_add_to_cart_button', 'multiple_orders_text' );
function woo_custom_order_button_text() {
    return __( 'Request Shipping Quote', 'woocommerce' );
}
Run Code Online (Sandbox Code Playgroud)

但是发现如果我添加该行

$this->order_button_text  = __( 'Request a Quote', 'woocommerce' );
Run Code Online (Sandbox Code Playgroud)

到其中的setup_properties()方法woocommerce/includes/gateways/cod/class-wc-gateway-cod.php确实有效。

然而,这显然是不好的做法,因为我正在破解一个核心插件文件。

如何在不破解 woocommerce 核心文件的情况下实现这一目标?

php wordpress jquery checkout woocommerce

2
推荐指数
1
解决办法
4140
查看次数

折叠字段“xxx”的未知类型,仅接受关键字和数字错误

如果我向以下查询添加折叠子句,则会出现错误

“折叠类型未知aircraft_type_search,仅接受关键字和数字”

被返回。

 {
"query": {
  "bool": {
    "must": {
      "bool": {
        "must": [
          {
            "match": {
              "aircraft_type_search": {
                "query": "piper"
              }
            }
          }
        ]
      }
    },
    "filter": {
      "bool": {
        "must": {
          "term": {
            "display_picture": "yes"
          }
        }
      }
    }
  }
},
"collapse": {
  "field": "aircraft_type_search"
}
}
Run Code Online (Sandbox Code Playgroud)

我也尝试过'aircraft_id'作为折叠字段,因为它是一个整数:

'aircraft_id' => [ 'type' => 'integer', "null_value" => "-1", "ignore_malformed" => 'true', 'include_in_all' => 'false', 'index' => 'not_analyzed' ]
Run Code Online (Sandbox Code Playgroud)

但这导致了错误。

AWS Elastic Search 服务上的 ES7.1 通过 …

elasticsearch elasticsearch-query

2
推荐指数
1
解决办法
4009
查看次数