1. Home
  2. Docs
  3. WooCommerce Variations Optimizer
  4. Developers
  5. Hooks

Hooks

This are some of the hooks that can be useful for your own customization.


woocommerce_variation_prices

This is the same filter hook used by WooCommerce with the addition of an extra 4th parameter indicating that the prices are coming from the “Product variable (optimized)” type. This can be used to add compatibility missing compatibility with 3rd party plugins.

Parameters

$prices
array
List of prices found.

$product
WC_Product|WC_Product_Variable_Optimized
Product.

$for_display
bool
Indicates if taxes should be calculated or not.

$reference
string
Process reference. Comes from WooCommerce or this plugin. Make sure to default this as null in your hook.

Example

add_filter(
    'woocommerce_variation_prices',
    function( $prices, $product, $for_display, $ref = null ) {
        if ( $ref === 'optimized' ) {
            // YOU CODE
        }
        return $prices;
    },
    10,
    4 // num of params
);
Was this article helpful to you? Yes No 2