This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'formatted_woocommerce_price', 'ts_woo_decimal_price', 10, 5 ); | |
function ts_woo_decimal_price( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) { | |
$unit = number_format( intval( $price ), 0, $decimal_separator, $thousand_separator ); | |
$decimal = sprintf( '%02d', ( $price - intval( $price ) ) * 100 ); | |
return $unit . '<sub>' . $decimal_separator. $decimal . '</sub>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'formatted_woocommerce_price', 'ts_woo_decimal_price', 10, 5 ); | |
function ts_woo_decimal_price( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) { | |
$unit = number_format( intval( $price ), 0, $decimal_separator, $thousand_separator ); | |
$decimal = sprintf( '%02d', ( $price - intval( $price ) ) * 100 ); | |
return $unit . '<small>' . $decimal_separator. $decimal . '</small>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'formatted_woocommerce_price', 'ts_woo_decimal_price', 10, 5 ); | |
function ts_woo_decimal_price( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) { | |
$unit = number_format( intval( $price ), 0, $decimal_separator, $thousand_separator ); | |
$decimal = sprintf( '%02d', ( $price - intval( $price ) ) * 100 ); | |
return $unit . '<sup>' . $decimal_separator. $decimal . '</sup>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'formatted_woocommerce_price', 'ts_woo_decimal_price', 10, 5 ); | |
function ts_woo_decimal_price( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) { | |
$unit = number_format( intval( $price ), 0, $decimal_separator, $thousand_separator ); | |
$decimal = sprintf( '%02d', ( $price - intval( $price ) ) * 100 ); | |
return $unit . '<sub>' . $decimal . '</sub>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'formatted_woocommerce_price', 'ts_woo_decimal_price', 10, 5 ); | |
function ts_woo_decimal_price( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) { | |
$unit = number_format( intval( $price ), 0, $decimal_separator, $thousand_separator ); | |
$decimal = sprintf( '%02d', ( $price - intval( $price ) ) * 100 ); | |
return $unit . '<sup>' . $decimal . '</sup>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_product_add_to_cart_text', 'woocommerce_change_add_to_cart_text', 10, 2 ); | |
function woocommerce_change_add_to_cart_text( $text, $product ) { | |
if( ! $product->is_purchasable() ) { | |
$text = 'Coming Soon'; | |
} | |
return $text; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_is_purchasable', 'woocommerce_hide_add_to_cart_button', 10, 2 ); | |
function woocommerce_hide_add_to_cart_button( $is_purchasable = true, $product ) { | |
$current_date = date('Y-m-d'); | |
$release_date = date( 'Y-m-d', strtotime('2018-10-10') ); | |
if( strtotime($current_date) < strtotime($release_date) && $product->get_id() == 335 ) { | |
$is_purchasable = false; | |
} | |
return $is_purchasable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_is_purchasable', 'woocommerce_hide_add_to_cart_button', 10, 2 ); | |
function woocommerce_hide_add_to_cart_button( $is_purchasable = true, $product ) { | |
return ( $product->get_id() == 335 ? false : $is_purchasable ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('woocommerce_cart_calculate_fees', 'ts_add_custom_discount', 10, 1 ); | |
function ts_add_custom_discount( $wc_cart ){ | |
$discount = 0; | |
$product_ids = array(); | |
$product_id = 2216; | |
$in_cart = false; | |
foreach ( $wc_cart->get_cart() as $cart_item_key => $cart_item ) { | |
$cart_product = $cart_item['data']; | |
if ( $cart_product->get_id() == $product_id ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('woocommerce_cart_calculate_fees', 'ts_add_custom_discount', 10, 1 ); | |
function ts_add_custom_discount( $wc_cart ){ | |
$discount = 0; | |
$product_ids = array(); | |
$item_prices = array(); | |
$in_cart = false; | |
foreach ( $wc_cart->get_cart() as $cart_item_key => $cart_item ) { |