Black Friday All Access $999 $399 lifetime or 30% off any plugin with Ends in -- See deals
View Categories

Bulk Price Editor: Developer Hooks and Filters Reference

Bulk Price Editor developer reference: filters and options #

This reference lists the code hooks and stored options in the Price Update: Bulk Pricing Editor for WooCommerce. It is aimed at developers extending the plugin or reading its stored data. All names are taken directly from the source of Pro v2.0.4.

Filters #

The plugin exposes four filters. Three shape the price math and product query; one is the internal Pro gate.

Filter Arguments Purpose
alg_wc_bpc_round_price $price, $round_function, $round_coef Rounds the modified price. Pro registers the default handler; without it, the Rounding function has no effect.
alg_wc_bpc_pretty_price $price, $threshold Applies the charm-price (“pretty prices”) shaping. Runs only when the threshold is above 0.
alg_wc_bpc_product_query $args, $taxonomy, $terms Adds a tax query to the product WP_Query for tag and attribute filtering. Pro registers the default handler.
alg_wc_bpc_settings $value, $type, $args Internal Pro gate. Pro returns an empty string to enable the Pro fields; without Pro it returns the passed default (the disabled attribute or an upsell note).

How the price filters fire #

Inside Alg_WC_Bulk_Price_Converter_Core::change_price(), after the arithmetic and before the final store rounding:

// Rounding (only when a rounding function is chosen)
if ( 'none' != $this->atts['round_function'] ) {
    $modified_price = apply_filters(
        'alg_wc_bpc_round_price',
        $modified_price,
        $this->atts['round_function'],
        $this->atts['round_coef']
    );
}
// ... round to woocommerce_price_num_decimals ...
// Pretty price (only when threshold > 0)
if ( $this->atts['pretty_prices_threshold'] > 0 ) {
    $modified_price = apply_filters(
        'alg_wc_bpc_pretty_price',
        $modified_price,
        $this->atts['pretty_prices_threshold']
    );
}

The Pro handler for alg_wc_bpc_round_price is simply:

function round_price( $price, $round_function, $round_coef ) {
    return $round_function( $price / $round_coef ) * $round_coef;
}

So $round_function is one of the PHP callables round, floor, or ceil, and the price is snapped to the nearest multiple of $round_coef.

Example: custom rounding to the nearest 0.95 #

To force all corrected prices to end in .95 regardless of the coefficient set in the UI:

add_filter( 'alg_wc_bpc_round_price', function( $price, $fn, $coef ) {
    return floor( $price ) + 0.95;
}, 20, 3 );

Example: extend the product query #

The plugin passes tag and attribute filters through alg_wc_bpc_product_query. You can add your own conditions to the same WP_Query args:

add_filter( 'alg_wc_bpc_product_query', function( $args, $taxonomy, $terms ) {
    // Only touch published products, for example.
    $args['post_status'] = 'publish';
    return $args;
}, 20, 3 );

Stored options #

Settings are plain options, read with get_option(). There are no custom tables.

Option Default Meaning
alg_wc_bulk_price_converter_step 6 Number of decimals; sets the step of the tool’s number inputs (1 / pow(10, value)).
alg_wc_bulk_price_converter_block_size 1024 Products loaded per WP_Query page during a run.
alg_wc_bulk_price_converter_time_limit -1 Seconds per query via set_time_limit(). 0 = no limit, -1 = server default.
alg_wc_bulk_price_converter_version current version Tracks the installed version for the update routine.

How prices are written #

wpf bulk price editor for woocommerce Icon

Bulk Price Editor

Get more from Bulk Price Editor

See every feature and the pricing on the Bulk Price Editor plugin page.

The tool writes prices directly to post meta (_price, _regular_price, _sale_price) with update_post_meta() and then calls wc_delete_product_transients(). It does not go through the WooCommerce CRUD ($product->set_price()), so if you rely on the WooCommerce data store or the product meta lookup table, plan to resync after a large run. This is the mechanism to be aware of when reading prices your own integration depends on.

Need a hand? #

For extension questions, our team answers on the Bulk Price Editor support forum.