Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  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' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement