Knowledge Base

WooCommerce: Get formatted price in result title or in content

in Ajax Search Pro Tips Tags: content pricecustom fieldpriceprice fieldtitletitle pricewoocommerce

The plugin allows displaying custom field contents within results, it also recognizes the WooCommerce price custom field, and prints the formatted price as result.

These fields allow displaying custom field values, such as the WooCommerce price '_price' field to display the product price. For example, inputting:

{titlefield}[ - Price: {_price}]

..into the title field, will result in:

In case of WooCommerce, the following custom fields can be used for price display:

  • _price
  • _tax_price
  • _regular_price
  • _sale_price

For example, you can combine the _regular_price and _sale_price to display a sale:

{titlefield}[ - Now only: {_sale_price} instead of][ - {_regular_price}]

..which results in:

For more examples & to learn more about the advanced title and content fields, please check the following resources: