1. Documentation /
  2. Developer Filters Included in Product Condition for WooCommerce

Developer Filters Included in Product Condition for WooCommerce

There are a number of developer filters included in Product Condition for WooCommerce in order to let you customize the plugin for your specific use case.

  • product_condition_options: return array
    • The product_condition_options filter accepts one argument, $product_conditions, which is an array of product conditions. The plugin expects that the filter will return an array with the keys being the product condition’s slug, and values being a translatable string with the “human readable” product conditions.
  • product_condition_schema_OfferItemCondition: return string
    • The product_condition_schema_OfferItemCondition filter accepts two arguments, $schema and $condition.
    • $schema: Is expected to be one of the four OfferItemCondition values, which include NewCondition, UsedCondition, RefurbishedCondition, and DamagedCondition.
    • $condition: The slug of the product condition that was set for the product that is being displayed.
  • product_condition_display_label: return string
    • The product_condition_display_label filter accepts two arguments $label and $product_id.
    • $label: Is the text that is shown before the product condition on the product page. Default is Product Condition:.
    • $product_id: Is the product’s ID in WooCommerce. This can be used to return a different label based on the product being displayed.
  • product_condition_display_shop_label: return string
    • The product_condition_display_shop_label filter accepts two arguments $label and $product_id.
    • $label: Is the text that is shown before the product condition on the shop or category page. Default is Product Condition:.
    • $product_id: Is the product’s ID in WooCommerce. This can be used to return a different label based on the product being displayed.
  • product_condition_settings_fields: return array
    • The product_condition_settings_fields filter accepts one argument, $settings, which is an array of the settings fields used in the WooCommerce > Settings > Products tab > Product condition sub-tab.
    • Note: This filter should not be used unless there is a need to add additional options to the plugin.