SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php // only copy this line if needed
  2. /**
  3.  * Hide the unit price from the top of the product page
  4.  * for Measurement Calculator products
  5.  */
  6. function sv_wc_measurement_price_calculator_hide_unit_price() {
  7.     global $product;
  8.    
  9.     // bail if the calculator isn't active or this isn't a product page
  10.     if ( ! class_exists( 'WC_Price_Calculator_Product' ) || ! is_product() ) {
  11.         return;
  12.     }
  13.    
  14.     $measurement = WC_Price_Calculator_Product::calculator_enabled( $product );
  15.    
  16.     // if the calculator is enabled, hide unit price
  17.     if ( $measurement ) {
  18.         echo '<style> .wc-measurement-price-calculator-price .woocommerce div.product p.price { display: none !important; } </style>';
  19.     }
  20. }
  21. add_action( 'wp_print_footer_scripts', 'sv_wc_measurement_price_calculator_hide_unit_price' );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top