您当前的位置:首页 > wordpress

怎么在WooCommerce详情下方购物按钮添加一个简码

时间:2025-06-25 15:05:17    来源:    作者:
详情后短码
add_action('woocommerce_after_single_product_summary', 'add_shortcode_after_product_summary', 40);
function add_shortcode_after_product_summary() {
    echo do_shortcode('[elementor-template id="2307"]');
}

购物按钮前短码
add_action('woocommerce_single_product_summary', 'add_shortcode_before_cart', 10);
function add_shortcode_before_cart() {
    echo do_shortcode('[elementor-template id="3647"]');
}
购物按钮后按钮
add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );
function my_extra_button_on_product_page() {
  global $product;
  echo '<a class="naibabutton" href="/contact/">MESSAGE</a>';
}
/*CSS*/
.naibabutton {
        color:#fff;
        border-radius: 12px 12px 12px 12px;
        padding:10px 30px;     
    background-color: #00A19F;
    border-style: none;
    box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
}
a.naibabutton:hover{ color:#eee; }
/*CSS*/
 
推荐资讯