'_product_prefix', 'label' => 'Prefix', 'description' => 'Add prefix to price. Leave blank to default.', 'desc_tip' => 'true', ) ); //Add metabox suffix to product woocommerce_wp_text_input( array( 'id' => '_product_suffix', 'label' => 'Suffix', 'description' => 'Add suffix to price. Leave blank to default.', 'desc_tip' => 'true', ) ); } /*Save metabox prefix and suffix*/ add_action( 'woocommerce_process_product_meta', 'hocwp_presuffix_products_save' ); function hocwp_presuffix_products_save( $post_id ) { if ( ! empty( $_POST['_product_prefix'] ) ) { update_post_meta( $post_id, '_product_prefix', esc_attr( $_POST['_product_prefix'] ) ); } if ( ! empty( $_POST['_product_suffix'] ) ) { update_post_meta( $post_id, '_product_suffix', esc_attr( $_POST['_product_suffix'] ) ); } } /*Add to price html*/ add_filter( 'woocommerce_get_price_html', 'bbloomer_price_prefix_suffix', 100, 2 ); function bbloomer_price_prefix_suffix( $price, $product ){ $prefix = get_option( 'hocwp_woocommerce_price_prefix'); $suffix = get_option( 'hocwp_woocommerce_price_suffix'); $prefix_product = get_post_meta($product->get_ID(), '_product_prefix', true); $suffix_product = get_post_meta($product->get_ID(), '_product_suffix', true); if($prefix_product) $prefix = $prefix_product; if($suffix_product) $suffix = $suffix_product; $prefix = ($prefix)?''.$prefix.'':''; $suffix = ($suffix)?''.$suffix.'':''; $price = $prefix.$price.$suffix; return apply_filters( 'woocommerce_get_price', $price ); } /*BAIF VIET LIEN QUAN CHUYEN MUC*/ Thực đơn giá “sinh viên” đi chợ chỉ hết 60k mà đủ các món ngon lành – quannhau

Thực đơn giá “sinh viên” đi chợ chỉ hết 60k mà đủ các món ngon lành

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *