Ali
Forum Replies Created
-
Forum: Plugins
In reply to: [PDF Invoices and Packing Slips For WooCommerce] custom fontThank you for your response.
I just sent the related info at the link.
about the option that you have sent, well it’s not there in my version (latest free version from depository). Maybe it’s only for pro versions?
Forum: Plugins
In reply to: [PDF Invoices and Packing Slips For WooCommerce] custom fontAny help please? None of the fonts are applied to Farsi or Arabic words in PDF despite previewing correctly in customizer. I even tried it on your demo site and it didn’t work either. I’ll type something in Farsi for you to try it yourself:
???? ??? ?? ???? ????? ????? ???.
Forum: Plugins
In reply to: [PDF Invoices and Packing Slips For WooCommerce] custom fontanother issue is that none of the default fonts seem to change RTL words in PDF despite changing them in preview! My invoice is in Farsi.
Thanks for the quick response. They are enabled. I just submitted a ticket.
Thank you very much. I just made a request on your website under number (14515).
Bests of luckthank you very much for the hard work.
I’ve been playing around with this for a while but it doesn’t seem to trigger anything.
Maybe I’m going about it wrong?I made a custom checkout text field, added the id national_code, and then added the snippet you sent to functions.php of my theme.
should I do anything else?
thanksThank you dear.
This did not work. Is it only checking the field to be a 10-digit number?
“national code” follows certain algorithms that should be checked as well. the code I provided checks them, too.
Is it possible to also incorporated them?
Many thanskHere’s only validation part:
function check_national_code($code) { if(!preg_match('/^[0-9]{10}$/',$code)) return false; for($i=0;$i<10;$i++) if(preg_match('/^'.$i.'{10}$/',$code)) return false; for($i=0,$sum=0;$i<9;$i++) $sum+=((10-$i)*intval(substr($code, $i,1))); $ret=$sum%11; $parity=intval(substr($code, 9,1)); if(($ret<2 && $ret==$parity) || ($ret>=2 && $ret==11-$parity)) return true; return false; }
allow me to translate and elaborate:
is it possible to have a “national ID number” AKA “National code” field in the checkout?
it’s a 10 digit number, nothing special so far.the tricky part is validation, I have been able to find the snippet for this field, the problem is I cannot incorporate that with “checkout field editor” plugin.
Can you help us make the validation possible?
the code:
<?php function check_national_code($code) { if(!preg_match('/^[0-9]{10}$/',$code)) return false; for($i=0;$i<10;$i++) if(preg_match('/^'.$i.'{10}$/',$code)) return false; for($i=0,$sum=0;$i<9;$i++) $sum+=((10-$i)*intval(substr($code, $i,1))); $ret=$sum%11; $parity=intval(substr($code, 9,1)); if(($ret<2 && $ret==$parity) || ($ret>=2 && $ret==11-$parity)){ return true;} else { return false;} } /** * Add the field to the checkout */ add_action( 'woocommerce_before_order_notes', 'national_code_field' ); function national_code_field( $checkout ) { echo '<div id="national_code_field"><h2>?? ???</h2>'; woocommerce_form_field( 'national_code', array( 'type' => 'text', 'class' => array('my-field-class form-row-wide'), 'label' => '????? ??? ?? ???? ????', 'placeholder' => '????? ... ', 'required' => true, 'validate' => array(), ), $checkout->get_value( 'national_code' )); echo '</div>'; } /** * Process the checkout */ add_action('woocommerce_checkout_process', 'national_code_field_process'); function national_code_field_process() { // Check if set, if its not set add an error. if ( ! $_POST['national_code'] ) { wc_add_notice('???? ?? ??? ??? ????? ???? ????.' , 'error' );} else { // Validates a phone number using a regular expression. if ( 10 != strlen( $_POST['national_code'] ) ) { wc_add_notice( '????? ???? 10 ???????? ????', 'error' ); } else { $n_code=$_POST['national_code']; $res=check_national_code($n_code); if($res!=1) wc_add_notice( '????? ???? ??? ???? ????????', 'error' ); }} } /** * Update the order meta with field value */ add_action( 'woocommerce_checkout_update_order_meta', 'national_code_field_update_order_meta' ); function national_code_field_update_order_meta( $order_id ) { if ( ! empty( $_POST['national_code'] ) ) { update_post_meta( $order_id, 'national_code', sanitize_text_field( $_POST['national_code'] ) ); } } /** * Display field value on the order edit page */ add_action( 'woocommerce_admin_order_data_after_billing_address', 'national_code_field_display_admin_order_meta', 10, 1 ); function national_code_field_display_admin_order_meta($order){ echo '<p><strong> ????? :</strong> ' . get_post_meta( $order->id, 'national_code', true ) . '</p>'; }
Hi
first, thanks for the very quick response, much appreciated!
I wanted to create the custom field “billing_postcode” to try your solution, but something weird happened!
It seems like the settings are cached and when I create any type of custom field (select, radio…) with the name billing_postcode, it turns to the “text” type!
I reset to the default fields and tried again with no luck.
what do you think I should do?
Thanks
Forum: Plugins
In reply to: [YITH WooCommerce Product Slider Carousel] doesn’t show productsDear @yotamdahan , thank you for responding. You were right. It’s a big shame because the plugin is entirely useless if it cannot loop in my opinion
Forum: Plugins
In reply to: [YITH WooCommerce Product Slider Carousel] doesn’t show productsI really appreciate any help
Forum: Plugins
In reply to: [TI WooCommerce Wishlist] style like the demoHi, any help please?
Forum: Plugins
In reply to: [Quantity Field on Shop Page for WooCommerce] center quantity selectorworked perfectly!
Thanks
Forum: Themes and Templates
In reply to: [OceanWP] center quantity selectorworked perfectly!
Thanks