单个产品汇总后如何在WooCommerce上添加html代码

如何在一个产品摘要后如何在woocommerce上添加HTML代码?

这是屏幕截图:

单个产品汇总后如何在WooCommerce上添加html代码

问候 戈兰拉比

lst0415 回答:单个产品汇总后如何在WooCommerce上添加html代码

add_action( 'woocommerce_product_after_tabs','my_product_after_tabs' );
function my_product_after_tabs() {
    echo 'html';
}

或者在覆盖和调整时

https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/tabs/tabs.php

https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/related.php

,
add_action( 'woocommerce_product_after_tabs','my_product_after_tabs' );
function my_product_after_tabs() {
    global $product;
    $product_id = $product->get_id();

    if ( $product_id == 1 ) {
        echo 'html 1';
    } elseif ( $product_id == 2 ) {
        echo 'html 2';      
    } elseif ( $product_id == 3 ) {
        echo 'html 3';
    } else {
        echo 'product id not found!';       
    }
}
本文链接:https://www.f2er.com/2828803.html

大家都在问