For Developers
Available Filters
Section titled “Available Filters”wpify_woo_prices_data
Section titled “wpify_woo_prices_data”Allows you to modify custom price data before display.
Parameters:
$price(array) - Price data containinglabel,value,type,suffix, etc.
Example:
add_filter( 'wpify_woo_prices_data', function( $price ) { // Add suffix to all prices $price['suffix'] .= ' incl. VAT';
return $price;} );wpify_woo_prices_should_display_price
Section titled “wpify_woo_prices_should_display_price”Controls whether a custom price should be displayed.
Parameters:
$display(bool) - Whether to display the price$custom_price(array) - Custom price settings$product(WC_Product) - Product
Example:
add_filter( 'wpify_woo_prices_should_display_price', function( $display, $custom_price, $product ) { // Don't display custom prices for virtual products if ( $product->is_virtual() ) { return false; }
return $display;}, 10, 3 );wcml_raw_price_amount
Section titled “wcml_raw_price_amount”Filter for WPML multi-currency support. The module automatically applies this filter for correct currency conversion.
Example:
add_filter( 'wcml_raw_price_amount', function( $price ) { // Custom currency conversion return $price * get_exchange_rate();} );Filter for Price HTML Modification
Section titled “Filter for Price HTML Modification”woocommerce_get_price_html
Section titled “woocommerce_get_price_html”The module uses this WooCommerce filter with priority 999.
Example of adding custom content:
add_filter( 'woocommerce_get_price_html', function( $price, $product ) { if ( ! is_product() ) { return $price; }
// Add badge to discounted products if ( $product->is_on_sale() ) { $price = '<span class="sale-badge">SALE</span>' . $price; }
return $price;}, 1000, 2 );Custom Hook for Display
Section titled “Custom Hook for Display”In the module settings, you can enter a custom WordPress hook for displaying the custom prices block:
// Example: display below short descriptionadd_action( 'woocommerce_single_product_summary', function() { do_action( 'my_custom_prices_location' );}, 25 );In the module settings, enter: my_custom_prices_location
CSS Classes
Section titled “CSS Classes”| Class | Description |
|---|---|
.wpify-woo-prices | Wrapper block for custom prices |
.wpify-woo-prices__price | Individual custom price |
.wpify-woo-prices__price-info | Info icon (question mark) |
.wpify-woo-prices__price-info__text | Tooltip text |
.wpify-woo-prices__regular-price-label | Regular price label |
.wpify-woo-prices__badge | Badge label for products not on sale |
Product Meta Data
Section titled “Product Meta Data”_custom_prices
Section titled “_custom_prices”Custom prices are stored in product post meta.
// Get custom price values$custom_prices = get_post_meta( $product_id, '_custom_prices', true );
// Structure:// [// 'uuid-1234' => 150.00, // For type 'custom'// 'uuid-5678' => [ // For type 'by_unit'// 'unit' => 'kg',// 'quantity' => 0.5// ]// ]Integration with Price History Module
Section titled “Integration with Price History Module”To get the lowest price programmatically:
$prices_log_module = wpify_woo_container()->get( \WpifyWoo\Modules\PricesLog\PricesLogModule::class);$lowest_price = $prices_log_module->get_lowest_price( $product_id );Example: Custom Price Block
Section titled “Example: Custom Price Block”add_action( 'woocommerce_single_product_summary', function() { global $product;
if ( ! $product->is_on_sale() ) { return; }
$prices_log = wpify_woo_container()->get( \WpifyWoo\Modules\PricesLog\PricesLogModule::class ); $lowest = $prices_log->get_lowest_price( $product->get_id() );
if ( $lowest ) { printf( '<div class="omnibus-notice">%s: %s</div>', __( 'Lowest price in 30 days', 'my-theme' ), wc_price( $lowest ) ); }}, 15 );