如何向WooCommerce产品属性添加额外信息?

问题描述 投票:0回答:1

在单个产品页面上,我想在特定的pa_attribute上添加更多信息图标(i或?)。因此,如果您单击一个?图标,您将会看到一个弹出窗口,以获取有关该特定属性的更多信息。 (例如:https://laadkompas.nl/offerte-aanvraag-1/?car-type=Universeel%2C+verschillende+elektrische+auto%27s&installatie=Ja&compire=Thuislocatie

我做了一些研究,但由于无法获得特定的php pa_attribute,所以无法编译代码。

Iv找到了此代码:但与pa = attribute及其工具提示无关。

add_action( 'woocommerce_before_variations_form', 'krank_custom_action', 2 );

function krank_custom_action() {
    echo '  <button class="krank-tooltip ttone" type="button" data-toggle="tooltip" data-placement="top" title="this is a text ">?</button>

有人可以编译此代码以使用额外的信息工具提示或单个产品页面上的弹出窗口来获得特定的pa属性(Woocommerce)?

php wordpress woocommerce custom-taxonomy
1个回答
0
投票

我做了一些研究,找到了正确的代码。它与特定的pa_attribute相关,但是现在我需要它使图标(?)可单击,并获得有关该特定产品属性的更多信息。

add_filter( 'woocommerce_attribute_label', 'custom_attribute_label', 10, 3 );

function custom_attribute_label($ label,$ name,$ product){$ taxonomy ='pa _'。$ name;

if( $taxonomy == 'pa_montagewijze' )
    $label .= '<div class = "customization_image_icon"><img class="alignleft wp-image-25335" src="https://laadkompas.nl/wp-content/themes/laadkompass/images/info.png" alt="" width="10" height="10" /></div>';

return $label;

}

有人可以在该特定属性上添加可点击的工具提示以获取更多信息吗?

© www.soinside.com 2019 - 2024. All rights reserved.