get_price breaks cart and checkout
-
Hi I made a filter function to modify prices of products, but in cart and checkout page products get 0 as price.
This is the function:
add_filter('woocommerce_get_price', 'return_custom_price', 10, 2); add_filter( 'woocommerce_product_get_price', 'return_custom_price', 10, 2 ); add_filter( 'woocommerce_product_variation_get_price', 'return_custom_price', 10, 2 ); add_filter( 'woocommerce_product_get_regular_price', 'return_custom_price', 10, 2 ); add_filter( 'woocommerce_product_get_sale_price', 'return_custom_price', 10, 2 ); function return_custom_price($price, $product) { global $post, $blog_id; $post_id = $value['product_id']; $price = get_post_meta($post->ID, '_regular_price', true); $ssivata = 7.93; $tax = 122/100; $shipping = 6.5; //calcola prezzo di fabbrica $price = $price - $ssivata; $price = $price / $tax; //calcolo del prezzo $price = $price + $shipping; $price = $price*$tax; return $price; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_price breaks cart and checkout’ is closed to new replies.