Abbreviating price

Home Forums Ticket Products Event Tickets Plus Abbreviating price

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #951114
    dotdash
    Participant

    Hello there,

    How can I abbreviate the display of prices that are rounded up to the ten i.e. €8.00 down to €8?

    And is there a way of achieving this without restricting prices which might be €8.50, for example?

    Cheers,

    Spencer

    #951162
    Barry
    Member

    Hi Spencer – great question!

    There are a few ways you might tackle this.

    Generally, the cost is displayed via the tribe_get_cost() template tag and this can be filtered via a hook of the same name – tribe_get_cost – so if you are familiar with using hooks and filters that would definitely provide a means of making this change.

    Does that help at all?

    #951213
    dotdash
    Participant

    This reply is private.

    #951214
    Barry
    Member

    Not really, the general concept is a WordPress one and is well covered in the Codex – but the basic form is like this:

    add_filter( 'tribe_get_cost', 'custom_cost_filter' );
    
    function custom_cost_filter( $cost ) {
        return 'Modified ' . $cost;
    }

    The actual logic to conditionally strip decimals is something we’d leave to you 🙂

    #955047
    Barry
    Member

    Hi!

    It’s been a while so I’m going to go ahead and close this topic.

    • Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
    • Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context

    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Abbreviating price’ is closed to new replies.