function my_format_sale_price( $regular_price, $sale_price ) {
$price = ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . ' Цена со скидкой' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price );
return $price;
}
add_filter( 'woocommerce_format_sale_price', 'my_format_sale_price', 10, 2);
remove_action( 'woocommerce_before_shop_loop_item_title', array( 'cherry_wc_quick_view', 'append_open_wrap' ), 0 );
add_filter( 'woocommerce_quantity_input_args', 'wpp_woocommerce_step_quantity_input', 10, 2 );
function wpp_woocommerce_step_quantity_input( $args, $product ) {
// ТУТ можете слазить в $product и сделать проверку на доп условие
// которое допишите к if ( is_cart( ) && допусловие )
if ( is_cart( ) ) {
$args['min_value'] = 50;
$args['step'] = 50;
}
return $args;
}
add_action('wp_insert_comment', 'wpp_comment_inserted', 99, 2);
function wpp_comment_inserted($comment_id, $comment_object) {
//$comment_object - объект комментария,
//получаете пост на который он оставлен
// и если это продукт отправляете письмо
}
add_action('transition_comment_status', 'wpp_comment_approve', 10, 3);
function wpp_comment_approve($new_status, $old_status, $comment_object) {
if( $old_status !== $new_status && $new_status === 'approved' ) {
//$comment_object - объект комментария,
//получаете пост на который он оставлен
// и если это продукт отправляете письмо
}
}
function wpp_add_units_after_price_in_cart( $price, $cart_item, $cart_item_key ) {
// если единицы измерения хранятся не в в мета поле _product_units, тут получаем их
// из места их хранения по своему
$units = get_post_meta( $cart_item['product_id'], '_product_units', true );
if ( ! empty( $units ) ) {
$price .= ' ' . $units ;
}
return $price;
}
add_filter( 'woocommerce_cart_item_price', 'wpp_add_units_after_price_in_cart', 10, 3 );