The WP Travel plugin allows you to add additional products or services to your trips using the Trip Extras feature.
By default, Trip Extra prices can only be positive values, which add to the total trip cost.

However, in some cases, you might want to apply negative pricing for example, to offer discounts or special deductions.

With a simple code snippet, developers or advanced users can now create Trip Extras with negative pricing, allowing greater flexibility for promotions or custom pricing logic.

Enable Negative Pricing

Add the following code to enable negative pricing for Trip Extras:

add_filter(β€˜wptravel_trip_extras_negative_price’, function() {
    return true;
});

Where to place the code?

You can add the above snippet in one of the following ways:

Child Theme’s functions.php file

  • Navigate to: /wp-content/themes/your-child-theme/functions.php
  • Paste the code snippet at the end of the file.

For step-by-step guidance, refer to our KnowledgeBase article on how to create a child theme.

Using a Code Snippets Plugin

  • Install and activate a plugin like Code Snippets.
  • Create a new snippet and paste the code above.
  • Save and activate the snippet.

    How to Add a Negative Price?

    Once the filter is enabled, you can enter a negative price directly in the Trip Extras section.

    Simply add a minus sign (-) before the price.
    Example: -50

    This negative value will be subtracted from the total trip cost.

    Example Screenshots:

    Trip Extra with Negative Price

    Trip Extra with Negative Price

    Reflected in Trip Total

    Reflected in Trip Total

    Check WP Travel documentation to learn more about configurations, modules, payments, and shortcodes.

    Your feedback helps us improve. Please share your thoughts.

    Need assistance? Contact our support team, join our Facebook community, and subscribe to our YouTube Channel for video tutorials.

    You can also find us on Facebook, Instagram, LinkedIn, TikTok, and X. Thank you for choosing WP Travel.

    If you are a WP Travel Free user thinking about upgrading to Pro, simply click on the banner below.

    Get WP Travel Pro