Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce Measurement Price Calculator - add info above the calculator
/**
* Example: checking if the calculator is being used for a product
*
* Adds a heading above the Measurement Price Calculator if enabled
*/
function sv_mpc_heading() {
if ( ! class_exists( 'WC_Price_Calculator_Product' ) ) {
return;
}
global $product;
$measurement = WC_Price_Calculator_Product::calculator_enabled( $product );
if ( $measurement ) {
echo '<h4>Test Heading</h4>';
}
}
add_filter( 'woocommerce_before_add_to_cart_button', 'sv_mpc_heading', 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment