• Resolved David Okoli

    (@enochdavid)


    How do I enable multicurrency on wpadverts or the ability for a buyer to switch currencies. Also would love to add a custom currency.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    The new currency you can add using this code snippet https://github.com/simpliko/wpadverts-snippets/blob/master/add-currency/add-currency.php

    As for having multiple currencies on-site i am afraid we do not have such feature in WPAdverts, it is only possible to have one currency. The only possible workaround is to disable currency validation so the users will be able to enter any text in the price field.

    Thread Starter David Okoli

    (@enochdavid)

    Am sorry for this que but how do I disable currency validation

    Plugin Author Greg Winiarski

    (@gwin)

    You can do that by adding the code below in your theme functions.php file

    
    add_filter( "adverts_form_load", "disable_currency_validation_form_load" );
    function disable_currency_validation_form_load( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "adverts_price" ) {
            $form["field"][$key]["class"] = "";
            $form["field"][$key]["filter"] = array();
        }
      }
      return $form;
    }
    add_filter( "adverts_get_the_price", "disable_currency_validation_get_price", 10, 2 );
    function disable_currency_validation_get_price( $price, $price_raw ) {
        return $price_raw;
    }
    
    Thread Starter David Okoli

    (@enochdavid)

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wpadverts’ is closed to new replies.