Portafolio Free Responsive Portfolio WordPress Theme
Ilyen volt:
Ilyen lett:
http://electroservice.hu/
http://vivaapartmansarvar.hu/
// Add min value to the quantity field (default = 1)add_filter('woocommerce_quantity_input_min', 'min_decimal');function min_decimal($val) { return 0.1;}// Add step value to the quantity field (default = 1)add_filter('woocommerce_quantity_input_step', 'nsk_allow_decimal');function nsk_allow_decimal($val) { return 0.1;}// Removes the WooCommerce filter, that is validating the quantity to be an intremove_filter('woocommerce_stock_amount', 'intval');// Add a filter, that validates the quantity to be a floatadd_filter( 'woocommerce_stock_amount', 'floatval' );add_filter( 'woocommerce_get_price_html', 'custom_price_message' );A mertekegyseg helyére írjuk be azt amit meg szeretnénk jeleníteni a pénznem után.
function custom_price_message( $price ) {
$vat = 'mertekegyseg';
return $price . $vat;
}
function themeprefix_custom_price_message( $price ) {
global $post;
$product_id = $post->ID;
$my_product_array = array( 12,13,14 );//add in product IDs
if ( in_array( $product_id, $my_product_array )) {
$textafter = '/kg'; //add your text
return $price . $textafter;
}
else { $textafter1 = '/db'; //add your text2
return $price . $textafter1;
}
}
add_filter( 'woocommerce_get_price_html', 'themeprefix_custom_price_message' );
Az //add in product IDs sornál a számok helyére (12,13,14) azoknak a termékeknek az ID-ját kell írnunk amellyeknél megszeretnék jeleníteni (jelenlesetben a "/kg"-t) az egyedi szöveget.