php - 如何使用带有优先订单号的自定义插件?
问题描述
我正在学习 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>");
解决方案
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>";
}
推荐阅读
- regex - 这两个正则表达式有什么区别?
- arrays - 将对象数组转换为累积字典 Swift
- kubernetes - 如何在 kube-scheduler 中显示调度策略
- r - 为什么在 R 中执行 fix() 后该函数起作用
- video - 什么是 CMAF 样本?
- angular - 尝试导入插件之前的完整日历库
- git - 错误:未能将一些参考推送到 'git@github.com:MyGitHub/foo.git'
- java - 如何从我的适配器内的活动中更改变量(传递给它的 java 类更改变量)
- c# - C# Rest API 错误:Bitstamp 的“缺少密钥、签名和随机数参数”。我确实将它们包含在代码中..可能有什么问题?
- asp.net-core - 是什么导致 __builder 在编译器的当前上下文错误中不存在?