customization - Rename WooCommerce sorting dropdown options

Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

How to rename the WooCommerce sorting dropdown options and customise the wording? For example, change "Popularity" to "Best Selling" or "Price: Low to High" to just "Price Low to High" without the colon.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

How to rename the WooCommerce sorting dropdown options and customise the wording? For example, change "Popularity" to "Best Selling" or "Price: Low to High" to just "Price Low to High" without the colon.

Share Improve this question edited Nov 26, 2019 at 8:03 tru.d 1861 gold badge1 silver badge17 bronze badges asked Nov 25, 2019 at 4:47 aye ceeaye cee 15912 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Add this code to functions.php and rename the relevant option. Here I have renamed the 'Popularity' option to 'Best Selling'.

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;
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744967938a4603796.html

相关推荐

  • customization - Rename WooCommerce sorting dropdown options

    Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress.

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信