因此,在俄語中,在Woocommerce重量和其他公制系統的設置中。但在產品頁面中,例如它仍然以英語(g - gramm)顯示。我已將文件復制到我的主題中:我應該在此文件中執行哪些操作才能以俄語顯示正確的重量公制系統?此代碼沒有幫助:/wp-content/themes/my_theme/woocommerce/single-product/product-attributes.php<td class="product_weight"><?php echo wc_format_localized_decimal( $product->get_weight() ) . ' ' . __(esc_attr( get_option( 'woocommerce_weight_unit' ) ), 'woocommerce'); ?></td>代碼 :/product-attributes.phpdefined( 'ABSPATH' ) || exit;if ( ! $product_attributes ) { return;}?><table class="woocommerce-product-attributes shop_attributes"> <?php foreach ( $product_attributes as $product_attribute_key => $product_attribute ) : ?> <tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--<?php echo esc_attr( $product_attribute_key ); ?>"> <th class="woocommerce-product-attributes-item__label"><?php echo wp_kses_post( $product_attribute['label'] ); ?></th> <td class="woocommerce-product-attributes-item__value"><?php echo wp_kses_post( $product_attribute['value'] ); ?></td> </tr> <?php endforeach; ?></table>謝謝!
1 回答

手掌心
TA貢獻1942條經驗 獲得超3個贊
完成,剛剛在主題的函數中發布了此代碼.php
function localize_weight_units($weight) {
return str_replace('g', 'г', $weight);
}
add_filter('woocommerce_format_weight', 'localize_weight_units');
- 1 回答
- 0 關注
- 68 瀏覽
添加回答
舉報
0/150
提交
取消