我想将图标添加到 Woocommerce 购物车和结账中的运输选项。
例如,在“本地取货”选项中,我想在选项旁边显示一个小商店图标,如下所示:https://ibb.co/jz0jJgk
我尝试在 Woocommerce>设置>运输选项中的“本地取货”选项的标题中添加此代码,但它没有显示我拥有的自定义商店图标。
Local Pickup <img src="examplesite.com/media/store_icon.png" alt="local store icon">
如果这是可能的...我需要在functions.php或哪个文件中添加什么代码?
感谢您的阅读。
UPDATE:
到目前为止我一直在使用这个(@Jainil 提供的有用提示)
add_filter( 'woocommerce_cart_shipping_method_full_label', 'filter_woocommerce_cart_shipping_method_full_label', 10, 2 );
function filter_woocommerce_cart_shipping_method_full_label( $label, $method ) {
$shipping_method_id = ['flat_rate:19'];
$label .= 'class="shipping_method"'('<img src="https://site.local/wp-content/uploads/2019/10/icon_store.png">', 'woocommerce');// Use the condition here with $method to apply the image to a specific method.
return $label;
}
但它在每个可用的运输选项中显示图标https://ibb.co/9ZJKVB8
我只想在特定的本地取件选项中显示图标。