将此代码添加到函数。php并重命名相关选项。在这里,我将“人气”选项重命名为“畅销”。
add_filter( \'woocommerce_catalog_orderby\', \'rename_sorting_option_woocommerce_shop\' );
function rename_sorting_option_woocommerce_shop( $options ) {
$options[\'popularity\'] = __( \'Best Selling\', \'woocommerce\' );
$options[\'date\'] = __( \'Newest\', \'woocommerce\' );
$options[\'price\'] = __( \'Price: Low to High\', \'woocommerce\' );
$options[\'price-desc\'] = __( \'Price: High to Low\', \'woocommerce\' );
return $options;
}