Discontinued Products for WooCommerce comes with a number of filters which allow you to customize the plugin’s behavior.
Actions
wdp_before_ajax_variations_discontinued
This action is fired once before all variations of a variable product are discontinued by pressing the “Discontinue all variations” button. It receives one argument: string
the id number of the product for which variations are being discontinued.
wdp_after_ajax_variations_discontinued
This action is fired once after all variations of a variable product are discontinued by pressing the “Discontinue all variations” button. It receives two arguments. WC_Product_Variable
The product’s object and an array
with the list of all variations found.
wdp_after_discontinue_variations_btn
Allows developers to add custom content after the “Discontinue all variations” button.
wdp_before_set_discontinued_products_to_outofstock
This action is fired once before all discontinued products are queried and their stock status is changed to out of stock.
wdp_after_set_discontinued_products_to_outofstock
This action is fired once after all discontinued products are queried and after their stock status has been changed to out of stock. It receives two arguments: an array
of discontinued products and an array
with all individual discontinued variations.
wdp_before_set_outofstock_products_back_to_discontinued
This action is fired once before all the previously discontinued and currently out of stock – products are queried and their stock status is changed back to discontinued.
wdp_after_set_outofstock_products_back_to_discontinued
This action is fired once after all the out of stock products have had their stock status changed back to discontinued. It receives 3 arguments: an array
of previously out of stock products, an array
with all the previously out of stock variations and an array
with variable products.
Filters
wcdp_should_count_discontinued_products
This filter allows developers to enable/disable the queries that are run when removing discontinued products from the total product count inside the “Product categories” widget.