Products Pricing - Filter Hook References

Modified on Thu, 09 Feb 2023 at 11:48 PM

This is simply a list of products pricing-related filter hooks included in the WooCommerce Catalog Mode - Pricing, Enquiry Forms & Promotions files. This list also includes the supported parameters and example codes.


wmodes-admin/product-pricing/get-mode-types

  • Parameters:
  • $mode_types array()
  • $args array()


Example Codes:

function custom_get_mode_types( $mode_types, $args ) {

//add your custom code here
return $mode_types;
}

add_filter( 'wmodes-admin/product-pricing/get-mode-types', 'custom_get_mode_types', 10, 2 );

wmodes-admin/product-pricing/get-mode-type-{mode_type_id}-fields

  • Parameters:
  • $fields array()
  • $args array()


Example Codes:

function custom_get_mode_type_mode_type_id_fields( $fields, $args ) {

//add your custom code here
return $fields;
}

add_filter( 'wmodes-admin/product-pricing/get-mode-type-{mode_type_id}-fields', 'custom_get_mode_type_mode_type_id_fields', 10, 2 );

wmodes-admin/product-pricing/get-adjustment-types

  • Parameters:
  • $adjustment_types array()
  • $args array()


Example Codes:

function custom_get_adjustment_types( $adjustment_types, $args ) {

//add your custom code here
return $adjustment_types;
}

add_filter( 'wmodes-admin/product-pricing/get-adjustment-types', 'custom_get_adjustment_types', 10, 2 );

wmodes-admin/product-pricing/get-adjustment-based-on-types

  • Parameters:
  • $based_on_types array()
  • $args array()


Example Codes:

function custom_get_adjustment_based_on_types( $based_on_types, $args ) {

//add your custom code here
return $based_on_types;
}

add_filter( 'wmodes-admin/product-pricing/get-adjustment-based-on-types', 'custom_get_adjustment_based_on_types', 10, 2 );

wmodes-admin/product-pricing/get-adjustment-based-on-visibility

  • Parameters:
  • $mode_type_ids array()
  • $args array()


Example Codes:

function custom_get_adjustment_based_on_visibility( $mode_type_ids, $args ) {

//add your custom code here
return $mode_type_ids;
}

add_filter( 'wmodes-admin/product-pricing/get-adjustment-based-on-visibility', 'custom_get_adjustment_based_on_visibility', 10, 2 );

wmodes-admin/product-pricing/get-calculate-from-visibility

  • Parameters:
  • $mode_type_ids array()
  • $args array()


Example Codes:

function custom_calculate_from_visibility( $mode_type_ids, $args ) {

//add your custom code here
return $mode_type_ids;
}

add_filter( 'wmodes-admin/product-pricing/get-calculate-from-visibility', 'custom_calculate_from_visibility', 10, 2 );

wmodes/product-pricing/calculate-product-{mode_type_id}-prices

  • Parameters:
  • $prices array()
  • $prices_args array()
  • $data array()


Example Codes:

function custom_calculate_product_mode_type_id_prices( $prices, $prices_args, $data ) {

//add your custom code here
return $prices;
}

add_filter( 'wmodes/product-pricing/calculate-product-{mode_type_id}-prices', 'custom_calculate_product_mode_type_id_prices', 10, 3 );

wmodes/product-pricing/get-limit-based-on

  • Parameters:
  • $amount numeric
  • $per_amount numeric
  • $based_on string
  • $data array()


Example Codes:

function custom_get_limit_based_on( $amount, $per_amount, $based_on, $data ) {

//add your custom code here
return $amount;
}

add_filter( 'wmodes/product-pricing/get-limit-based-on', 'custom_get_limit_based_on', 10, 4 );

wmodes/product-pricing/get-{based_on_type}-based-on-amount

  • Parameters:
  • $per_amount numeric
  • $data array()


Example Codes:

function custom_get_based_on_type_based_on_amount( $per_amount, $data ) {

//add your custom code here
return $per_amount;
}

add_filter( 'wmodes/product-pricing/get-{based_on_type}-based-on-amount', 'custom_get_based_on_type_based_on_amount', 10, 2 );

wmodes/get-regular-price

  • Parameters:
  • $regular_price numeric
  • $product array()
  • $variation array()


Example Codes:

function custom_get_regular_price( $regular_price, $product, $variation ) {

//add your custom code here
return $regular_price;
}

add_filter( 'wmodes/get-regular-price', 'custom_get_regular_price', 10, 3 );

wmodes/get-sale-price

  • Parameters:
  • $sale_price numeric
  • $product array()
  • $variation array()


Example Codes:

function custom_get_sale_price( $sale_price, $product, $variation ) {

//add your custom code here
return $sale_price;
}

add_filter( 'wmodes/get-sale-price', 'custom_get_sale_price', 10, 3 );

wmodes/get-price

  • Parameters:
  • $price numeric
  • $product array()
  • $variation array()


Example Codes:

function custom_get_price( $price, $product, $variation ) {

    //add your custom code here
    return $price;
}

add_filter( 'wmodes/get-price', 'custom_get_price', 10, 3 );

wmodes/view-data/get-price-adjustment

  • Parameters:
  • $price numeric
  • $adjustment_args array()
  • $product_data array()


Example Codes:

function custom_view_data_get_price_adjustment( $price, $adjustment_args, $product_data ) {

    //add your custom code here
    return $price;
}

add_filter( 'wmodes/view-data/get-price-adjustment', 'custom_view_data_get_price_adjustment', 10, 3 );

wmodes/view-data/get-calculated-prices

  • Parameters:
  • $prices array()
  • $product array()
  • $variation array()
  • $context string


Example Codes:

function custom_view_data_get_calculated_prices( $prices, $product, $variation, $context ) {

    //add your custom code here
    return $prices;
}

add_filter( 'wmodes/view-data/get-calculated-prices', 'custom_view_data_get_calculated_prices', 10, 4 );

wmodes/view-data/get-source-prices

  • Parameters:
  • $prices array()
  • $product array()
  • $variation array()
  • $context string


Example Codes:

function custom_view_data_get_source_prices( $prices, $product, $variation, $context ) {

    //add your custom code here
    return $prices;
}

add_filter( 'wmodes/view-data/get-source-prices', 'custom_view_data_get_source_prices', 10, 4 );

wmodes/get-form-price

  • Parameters:
  • $price_text string
  • $price string
  • $unformatted_price numeric
  • $args array()


Example Codes:

function custom_get_form_price( $price_text, $price, $unformatted_price, $args ) {

    //add your custom code here
    return $price_text;
}

add_filter( 'wmodes/get-form-price', 'custom_get_form_price', 10, 4 );


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article