首页 > 解决方案 > 如何使用带有优先订单号的自定义插件?

问题描述

我正在学习 WooCommerce 开发。我安装了 pin checker 插件,它显示在添加到购物车按钮上方。截图在这里https://prnt.sc/xftmpn

现在我已经显示了引脚检查器下面的段落,我使用了下面的代码,但它显示在引脚检查器上方。

function action_woocommerce_single_product_pinchecker_content() {
    echo "<span>Please enter PIN code to check delivery time & other more</span>";
}
 add_action( 'woocommerce_single_product_summary', 'action_woocommerce_single_product_pinchecker_content', 28, 0 );

我可以用 jQuery 做到这一点并且它正在工作,但我不想用 jQuery 做到这一点。

$('.pin_div').append("<span>Please enter PIN code to check delivery time & other more</span>");

标签: phpwordpresswoocommerceproducthook-woocommerce

解决方案


add_action( 'woocommerce_after_add_to_cart_form', 'mujuonly_before_add_to_cart_btn' );

function mujuonly_before_add_to_cart_btn() {
    echo "<span>" . __( 'Please enter PIN code to check delivery time & other more<', 'woocommerce' ) . "/span>";
}

推荐阅读