Skip to content

Instantly share code, notes, and snippets.

@bekarice
Created May 20, 2015 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bekarice/811c08b7762d64081e11 to your computer and use it in GitHub Desktop.
Save bekarice/811c08b7762d64081e11 to your computer and use it in GitHub Desktop.
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