WordPress filter hook

woocommerce_product_get_price

Fired by 10 WordPress plugins, running on 363K+ sites between them.

How to use woocommerce_product_get_price

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_product_get_price', function( $price, $objInfo ) {
	// Change $price here.
	return $price;
}, 10, 2 );

Argument names come from Unlimited Elements for Elementor's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

10 plugins that fire woocommerce_product_get_price

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Unlimited Elements for Elementor icon Unlimited Elements for Elementor300,000+ installs apply_filters( 'woocommerce_product_get_price', $price, $objInfo ) provider/woocommerce_integrate.class.php:731
  2. CURCY icon CURCY20,000+ installs apply_filters( 'woocommerce_product_get_price', $display_price, $product ) frontend/price.php:112
  3. Wholesale Suite icon Wholesale Suite20,000+ installs apply_filters( 'woocommerce_product_get_price', $price_arr['wholesale_price_raw'], $product ) includes/class-wwp-wholesale-prices.php:477
  4. WPC Composite Products for WooCommerce icon WPC Composite Products for WooCommerce9,000+ installs apply_filters( 'woocommerce_product_get_price', 0, $this ) includes/class-product.php:44
  5. YayCurrency icon YayCurrency7,000+ installs apply_filters( 'woocommerce_product_get_price', $display_price, $product ) includes/Engine/Compatibles/WooCommerceBookings.php:97
  6. Product Bundle Builder for WooCommerce icon Product Bundle Builder for WooCommerce6,000+ installs apply_filters( 'woocommerce_product_get_price', (string) $parent_price, $this ) src/ProductBundle.php:493
  7. Unlimited Elements Blocks Library icon Unlimited Elements Blocks Library500+ installs apply_filters( 'woocommerce_product_get_price', $price, $objInfo ) provider/woocommerce_integrate.class.php:731
  8. BundleBoss icon BundleBoss90+ installs apply_filters( 'woocommerce_product_get_price', $amount, $ref ) includes/pricing.php:324
  9. Stock Level Pricing icon Stock Level Pricing10+ installs apply_filters( 'woocommerce_product_get_price', $original_price, $product ) includes/price-adjustment-handler.php:116
  10. Yay Bulk Order for WooCommerce icon Yay Bulk Order for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_product_get_price', $raw_price, $product ) includes/Services/PricingService.php:48

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.