Forums Forums Search & Filter Pro Change currency symbol on custom archive file

Viewing 8 posts - 1 through 8 (of 8 total)
  • Anonymous
    #259720

    Hi,

    I use your plugin and set up a archive file to show the output.
    Now I want to change the WooCommerce currency symbol on the shortcode loaded inside this archive file but it not working.

    It does not recognize the chiptuning-archive.php file as template.

    add_filter( 'woocommerce_currency_symbol', 'change_currency_symbol', 10, 2 );
    
    function change_currency_symbol( $symbols, $currency ) {
    	
    	if ( is_page_template( 'archive-chiptuning.php' ) && ( 'EUR' === $currency )) {
    		
    		return '';
    	}
    
            return $symbols;
    }

    Any idea?

    Trevor
    #259749

    It is likely that you are using the WooCommerce display results method, in which case this would not be within the scope of our support. What method are you using?

    Anonymous
    #259790
    This reply has been marked as private.
    Trevor
    #259892

    I think the issue is your use of the WordPress is_page_template(), which will not do what you want.

    You need to use something like this:

    https://wordpress.stackexchange.com/questions/10537/get-name-of-the-current-template-file

    Anonymous
    #259933
    This reply has been marked as private.
    Trevor
    #259935
    This reply has been marked as private.
    Anonymous
    #259958

    It has to do with the page template outside the loop. Solved my own problem;

    add_filter( 'woocommerce_currency_symbol', 'change_currency_symbol', 10, 2 );
    
    function change_currency_symbol( $symbols, $currency ) {
        
        global $template;
        
        if ( basename( $template ) === 'archive-chiptuning.php' && ( 'EUR' === $currency )) {
            return '';
        }
            return $symbols;
    }
    Trevor
    #259978

    Thanks for letting me know. I will close this thread for now.

Viewing 8 posts - 1 through 8 (of 8 total)