Show Price Suffix only on all WooCommerce Product loops

前端 未结 2 1759
盖世英雄少女心
盖世英雄少女心 2020-12-21 17:39

I have an online shop with WooCommerce. I want to show a custom price Suffix only on the Product List Page (like Shop Page), where all products are listed.

I have the

2条回答
  •  自闭症患者
    2020-12-21 18:14

    As mentioned in the comments you can use the is_shop() function to check if you are on the shop page like this:

    add_filter( 'woocommerce_get_price_html', 'custom_price_suffix', 100, 2 );
    function custom_price_suffix( $price, $product ) {
        if ( is_shop() ) $price .= ' ' . __('Suffix');
        return $price;
    }
    

提交回复
热议问题