How can I add html code on WooCommerce after single product summary

限于喜欢 提交于 2020-03-14 05:35:01

问题


How can I add HTML code on woocommerce after a single product summary?

Here is the screenshot:

Regards Golam Rabbi


回答1:


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

Or when overwriting and adjusting

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




回答2:


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://stackoverflow.com/questions/59568057/how-can-i-add-html-code-on-woocommerce-after-single-product-summary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!