📌  相关文章
📜  在产品存档上的“添加到购物车”旁边添加按钮 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:58.380000             🧑  作者: Mango

代码示例1
add_action('woocommerce_after_shop_loop_item', 'add_a_custom_button_apply', 1 );
function add_a_custom_button_apply() {
    global $product;

    // Not for variable and grouped products that doesn't have an "add to cart" button
    if( $product->is_type('variable') || $product->is_type('grouped') ) return;

    // Output the custom button linked to the product
    echo '' . __('Apply Now') . '';
}