WPCS - WordPress Currency Switcher Professional

Filtro wpcs_shortcode_price_html_manipulation

En el shortcode [wpcs_price] permite manipular el código HTML del precio generado. (desde la v. 2.3.1/1.3.1)

Ejemplo:

  • shortcode: [wpcs_price type=fixed value=EUR:45,USD:70 name='sh1']
  • Para manipularlo, utilice el siguiente código (a modo de ejemplo):
    add_filter('wpcs_shortcode_price_html_manipulation', function ($price_html, $atts, $current_currency) {
        if (isset($atts['name'])) {
            switch ($atts['name']) {
                case 'sh1':
                    $price_html = preg_replace('/\.\d{2}/', '', $price_html);
                    break;
                default :
                    //you can add more cases if need
                    break;
            }
        }
    
        return $price_html;
    }, 10, 3);
    

     

Referencia: https://pluginus.net/support/topic/fixed-prices-does-not-work