Thêm đoạn code sau vào File funtions.php trong theme:
add_action('woocommerce_after_checkout_billing_form','devvn_xuat_hoa_don_vat'); function devvn_xuat_hoa_don_vat(){ ?> <style> .devvn_xuat_hoa_don_do { background: #eee; padding: 10px; border-radius: 3px; } .devvn_xuat_vat_wrap { display: none; } label.devvn_xuat_vat_input_label { display: block; cursor: pointer; margin-bottom: 0; } .devvn_xuat_vat_wrap fieldset { margin: 10px 0; padding: 10px; background: transparent; border: 1px solid #b0aeae; } .devvn_xuat_vat_wrap fieldset legend { background: transparent; padding: 0 5px; margin: 0 0 0 10px; font-size: 14px; display: inline; width: inherit; border: 0; text-transform: none; color: #000; } .devvn_xuat_vat_wrap fieldset p { margin-bottom: 10px; } .devvn_xuat_vat_wrap fieldset p:last-child { margin-bottom: 0; } .vat_active .devvn_xuat_vat_wrap { display: block; } </style> <div class="devvn_xuat_hoa_don_do"> <label class="devvn_xuat_vat_input_label"> <input class="devvn_xuat_vat_input" type="checkbox" name="devvn_xuat_vat_input" value="1"> Xuất hóa đơn VAT </label> <div class="devvn_xuat_vat_wrap"> <fieldset> <legend>Thông tin xuất hóa đơn:</legend> <p class="form-row form-row-first" id="billing_vat_company_field"> <label for="billing_vat_company" class="">Tên công ty <abbr class="required" title="bắt buộc">*</abbr></label> <input type="text" class="input-text " name="billing_vat_company" id="billing_vat_company" placeholder="" value=""> </p> <p class="form-row form-row-last" id="billing_vat_mst_field"> <label for="billing_vat_mst" class="">Mã số thuế <abbr class="required" title="bắt buộc">*</abbr></label> <input type="text" class="input-text " name="billing_vat_mst" id="billing_vat_mst" placeholder="" value=""> </p> <p class="form-row form-row-wide " id="billing_vat_companyaddress_field"> <label for="billing_vat_companyaddress" class="">Địa chỉ <abbr class="required" title="bắt buộc">*</abbr></label> <span class="woocommerce-input-wrapper"><input type="text" class="input-text " name="billing_vat_companyaddress" id="billing_vat_companyaddress" placeholder="" value=""></span> </p> </fieldset> </div> </div> <script type="text/javascript"> (function ($) { $(document).ready(function () { function check_vat(){ var parentVAT = $('input.devvn_xuat_vat_input').closest('.devvn_xuat_hoa_don_do'); if($('input.devvn_xuat_vat_input').is(":checked")){ parentVAT.addClass('vat_active'); }else{ parentVAT.removeClass('vat_active'); } } check_vat(); $('input.devvn_xuat_vat_input').on('change', function () { check_vat(); }); }); })(jQuery); </script> <?php } add_action('woocommerce_checkout_process', 'vat_checkout_field_process'); function vat_checkout_field_process() { if (isset($_POST['devvn_xuat_vat_input']) && !empty($_POST['devvn_xuat_vat_input'])) { if (empty($_POST['billing_vat_company'])) { wc_add_notice(__('Hãy nhập tên công ty') , 'error'); } if (empty($_POST['billing_vat_mst'])) { wc_add_notice(__('Hãy nhập mã số thuế') , 'error'); } if (empty($_POST['billing_vat_companyaddress'])) { wc_add_notice(__('Hãy nhập địa chỉ công ty') , 'error'); } } } add_action('woocommerce_checkout_update_order_meta', 'vat_checkout_field_update_order_meta'); function vat_checkout_field_update_order_meta($order_id) { if (isset($_POST['devvn_xuat_vat_input']) && !empty($_POST['devvn_xuat_vat_input'])) { update_post_meta($order_id, 'devvn_xuat_vat_input', intval($_POST['devvn_xuat_vat_input'])); if (isset($_POST['billing_vat_company']) && !empty($_POST['billing_vat_company'])) { update_post_meta($order_id, 'billing_vat_company', sanitize_text_field($_POST['billing_vat_company'])); } if (isset($_POST['billing_vat_mst']) && !empty($_POST['billing_vat_mst'])) { update_post_meta($order_id, 'billing_vat_mst', sanitize_text_field($_POST['billing_vat_mst'])); } if (isset($_POST['billing_vat_companyaddress']) && !empty($_POST['billing_vat_companyaddress'])) { update_post_meta($order_id, 'billing_vat_companyaddress', sanitize_text_field($_POST['billing_vat_companyaddress'])); } } } add_action( 'woocommerce_admin_order_data_after_shipping_address', 'devvn_after_shipping_address_vat', 99); function devvn_after_shipping_address_vat($order){ $devvn_xuat_vat_input = get_post_meta($order->get_id(), 'devvn_xuat_vat_input', true); $billing_vat_company = get_post_meta($order->get_id(), 'billing_vat_company', true); $billing_vat_mst = get_post_meta($order->get_id(), 'billing_vat_mst', true); $billing_vat_companyaddress = get_post_meta($order->get_id(), 'billing_vat_companyaddress', true); ?> <p><strong>Xuất hóa đơn:</strong> <?php echo ($devvn_xuat_vat_input) ? 'Có' : 'Không';?></p> <?php if($devvn_xuat_vat_input): ?> <p> <strong>Thông tin xuất hóa đơn:</strong><br> Tên công ty: <?php echo $billing_vat_company;?><br> Mã số thuế: <?php echo $billing_vat_mst;?><br> Địa chỉ: <?php echo $billing_vat_companyaddress;?><br> </p> <?php endif; }
It’s remarkable for me to have a site, which is useful designed for my knowledge.
thanks admin
After I initially commented I seem to have clicked on the -Notify me when new comments are added- checkbox and
from now on each time a comment is added I receive 4 emails with the same comment.
Perhaps there is an easy method you are able to remove me from
that service? Thank you!
My brother recommended I would possibly like this blog.
He was entirely right. This publish truly made my day.
You can not believe simply how much time I had spent for
this information! Thanks!
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your
point. You clearly know what youre talking about, why waste your intelligence on just
posting videos to your site when you could be giving us
something informative to read?
Helpful information. Lucky me I discovered your website by chance, and I’m stunned why this twist
of fate didn’t took place in advance! I bookmarked it.
A motivating discussion is definitely worth comment. I think that you need to write more about this topic, it might not be a taboo subject but typically people do not talk about
such issues. To the next! Kind regards!!
For the reason that the admin of this website is working, no uncertainty very quickly it will be renowned, due to its feature
contents.
Way cool! Some extremely valid points! I appreciate you penning this write-up and the
rest of the site is extremely good.
Hi! Do you use Twitter? I’d like to follow you if that would be ok.
I’m definitely enjoying your blog and look forward to new posts.
When I initially commented I seem to have clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment.
Is there a way you are able to remove me from that service?
Thanks!
Very good article! We are linking to this particularly
great content on our website. Keep up the great writing.
animehangover.com
이것만 의지하면 천군중에서 사람을 구할 수 있단 말인가?
скачать казино brillx
https://brillx-kazino.com
Наше казино стремится предложить лучший игровой опыт для всех игроков, и поэтому мы предлагаем возможность играть как бесплатно, так и на деньги. Если вы новичок и хотите потренироваться перед серьезной игрой, то вас приятно удивят бесплатные режимы игр. Они помогут вам разработать стратегии и привыкнуть к особенностям каждого игрового автомата.Играя на Brillx Казино, вы можете быть уверены в честности и безопасности своих данных. Мы используем передовые технологии для защиты информации наших игроков, так что вы можете сосредоточиться исключительно на игре и наслаждаться процессом без каких-либо сомнений или опасений.
brillx официальный сайт играть онлайн
https://brillx-kazino.com
Так что не упустите свой шанс вступить в мир Brillx Казино! Играйте онлайн бесплатно и на деньги в 2023 году, окунувшись в море невероятных эмоций и неожиданных поворотов. Brillx – это не просто игровые аппараты, это источник вдохновения и увлечения. Поднимите ставки и дайте себе шанс на большую победу вместе с нами!Играя на Brillx Казино, вы можете быть уверены в честности и безопасности своих данных. Мы используем передовые технологии для защиты информации наших игроков, так что вы можете сосредоточиться исключительно на игре и наслаждаться процессом без каких-либо сомнений или опасений.
nice content!nice history!! boba 😀
nice content!nice history!! boba 😀
nice content!nice history!! boba 😀
wow, amazing
[url=https://teplica-teplourala.ru]Теплицы новгород купить.[/url]
[url=https://teplica-teplourala.ru]Прямостенные теплицы от производителя цены.[/url]
[url=https://teplica-teplourala.ru]Теплицы прямостенные от производителя.[/url]
wow, amazing
nice content!nice history!! boba 😀
wow, amazing
nice content!nice history!! boba 😀
nice content!nice history!! boba 😀
wow, amazing
nice content!nice history!! boba 😀
wow, amazing
wow, amazing
nice content!nice history!! boba 😀
wow, amazing
wow, amazing
wow, amazing
nice content!nice history!! boba 😀
nice content!nice history!! boba 😀
wow, amazing
nice content!nice history!! boba 😀
wow, amazing
nice content!nice history!! boba 😀
wow, amazing
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
naturally like your web site however you need to take a look at the spelling on several of your posts. A number of them are rife with spelling problems and I find it very bothersome to tell the truth on the other hand I will surely come again again.