【发布时间】:2021-06-14 06:03:44
【问题描述】:
在 woocommerce 结帐时,我想将运输选项移到 woocommerce_order_review 之外,这没问题,但我需要在地址更新时更新它 - WC_AJAX::update_order_review()
我可以通过编辑 woocommerce/includes/class-wc-ajax.php 中的公共静态函数 update_order_review() 来完成这项工作,但我不想编辑核心文件。
有没有办法在我的主题函数文件中更改此函数?我要做的就是添加一个新片段
ob_start();
woocommerce_checkout_shipping_options();
$woocommerce_checkout_shipping_options = ob_get_clean();
并添加
'.woocommerce-checkout-shipping-table' => $woocommerce_checkout_shipping_options,
进入 woocommerce_update_order_review_fragments 数组。
我的主题functions.php中已经有了模板函数
function woocommerce_checkout_shipping_options( ) {
wc_get_template(
'checkout/shipping-options.php',
array(
'checkout' => WC()->checkout(),
)
);
}
add_action( 'woocommerce_checkout_shipping_option', 'woocommerce_checkout_shipping_options', 10 );
我无法在不编辑核心文件的情况下编辑 update_order_review 函数?
【问题讨论】:
标签: php ajax wordpress woocommerce checkout