• Hey, I need to detect the active currency with PHP so I can hide or show something on the site. Here´s the code I tried with no success:

    add_action( 'ocultar_preciobbva', 'bbva_ocultar' );
    function bbva_ocultar() {
    	if ( class_exists( 'WOOMULTI_CURRENCY_F_Data' ) )
    		$currency_data_obj = new WOOMULTI_CURRENCY_Data();
    		$current_currency = $currency_data_obj->get_current_currency();
    		if ( $current_currency == 'USD' ){
    			?><script type="text/javascript">
    			var bbvatext = document.getElementById("preciobbva");
    			bbvatext.style.display = "none";
    			console.log("NO MAS BBVA");
Viewing 1 replies (of 1 total)
  • Plugin Author thanhtd



    I see you use JS code without loaded event. So, maybe your code can not get element has id preciobbva.

    Run your PHP code in action wp_footer
    Run your JS code after page loaded.

    Hope it help you.

Viewing 1 replies (of 1 total)
  • The topic ‘Detecting currency with PHP’ is closed to new replies.