【问题标题】:How to use the custom plugin with the priority order number?如何使用带有优先订单号的自定义插件?
【发布时间】:2021-04-26 20:13:27
【问题描述】:

我正在学习 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>");

【问题讨论】:

    标签: php wordpress woocommerce product hook-woocommerce


    【解决方案1】:
    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>";
    }
    

    【讨论】:

    • 我试过了,但它显示在产品描述之前
    • 尝试将优先级 15 更改为 999 0r 6
    • 我尝试了 6 但没有工作然后我尝试了 29 然后我变得像这样 prnt.sc/xg0j5h 然后我尝试了 30 然后我变得像这样 prnt.sc/xg0z4p 我必须在密码检查器下方显示
    • 请分享密码检查器代码 - 中间会有一些钩子打印
    • 我怎样才能得到它?我正在使用这个插件wordpress.org/plugins/…
    猜你喜欢
    • 1970-01-01
    • 2018-08-28
    • 2022-08-18
    • 2018-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-26
    • 2021-01-17
    相关资源
    最近更新 更多