jquery - Javascript code works in fiddle but not in Wordpress (woocommerce) -


i added total price of after calculating regular price - sale price , added javascript code there, should hide price of total 0. works in fiddle doesnt work in wordpress. maybe put in wrong place (content-product.php)

my fiddle here: https://jsfiddle.net/foduxc0y/

and code in wordpress:

<html> <head> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>  <script> jquery( document ).ready(function($) {     "use strict";     if (parseint($(".win").text(), 10) === 0) {         $(".hinnavoit").hide();         $(".jah").hide();     } });   </script> </head> </html>  <?php /**  * template displaying product content within loops.  *  * override template copying yourtheme/woocommerce/content-product.php  *  * @author  woothemes  * @package woocommerce/templates  * @version 2.4.0  */  if ( ! defined( 'abspath' ) ) {     exit; // exit if accessed directly }  global $product, $woocommerce_loop;  // store loop count we're on if ( empty( $woocommerce_loop['loop'] ) ) {     $woocommerce_loop['loop'] = 0; }  // store column count displaying grid if ( empty( $woocommerce_loop['columns'] ) ) {     $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 ); }  // ensure visibility if ( ! $product || ! $product->is_visible() ) {     return; }  // increase loop count $woocommerce_loop['loop']++;  // post classes $classes = array(); if ( 0 == ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 == $woocommerce_loop['columns'] ) {     $classes[] = 'first'; } if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] ) {     $classes[] = 'last'; } ?> <li <?php post_class( $classes ); ?>>      <?php do_action( 'woocommerce_before_shop_loop_item' ); ?>      <figure class="item effect-bubba">         <?php             /**              * woocommerce_before_shop_loop_item_title hook              *              * @hooked woocommerce_show_product_loop_sale_flash - 10              * @hooked woocommerce_template_loop_product_thumbnail - 10              */             do_action( 'woocommerce_before_shop_loop_item_title' );         ?>               <figcaption>                   <div class="hover_icons" onclick="location.href='<?php the_permalink(); ?>';">             <i class="fa fa-file-text-o"></i> </br>             uuri lähemalt         </div>                   </figcaption>           </figure>          <div class="item_det">              <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>              <?php                 /**                  * woocommerce_after_shop_loop_item_title hook                  *                  * @hooked woocommerce_template_loop_rating - 5                  * @hooked woocommerce_template_loop_price - 10                  */                 do_action( 'woocommerce_after_shop_loop_item_title' );             ?>  <p> <span class="jah"> <span> sinu võit: <span class="win">     <span class="hinnavoit"><?php echo $product->get_regular_price()-$product->get_sale_price();?></span>€ </span> </span> </span> </p>  <?php do_action( 'woocommerce_after_shop_loop_item' );?>          </div> </li> 


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -