你可以使用woocommerce_before_add_to_cart_quantity
钩如下
add_action( 'woocommerce_after_add_to_cart_quantity', 'by_now' );
function by_now() {
echo '<div class="test"> buy now </div>';
}
在你的CSS中添加:
.test {
display: inline-block;
}
.woocommerce div.product form.cart .button {
vertical-align: middle;
float: none !important ;
}
产量
您网站的输出
你可以使用hook "Buy Now"
添加before
woocommerce_before_add_to_cart_button
。
add_action( 'woocommerce_before_add_to_cart_button', 'custom_content_before_addtocart_button', 100 );
function custom_content_before_addtocart_button() {
// custom content.
echo 'Buy Now';
}
你可以使用hook "Buy Now"
添加after
woocommerce_after_add_to_cart_button
。
add_action( 'woocommerce_after_add_to_cart_button', 'custom_content_after_addtocart_button', 100 );
function custom_content_after_addtocart_button() {
// custom content.
echo 'Buy Now';
}