Στο παρακάτω παράδειγμα ορίζουμε μέγιστο βάρος τα 2 κιλά εάν είναι πάνω απο 2, διαφορετικά θα πάρει το βάρος που έχει αυτόματα υπολογιστεί από τα προϊόντα
1 2 3 4 5 6 7 8 9 10 11 | function myweight( $weight ){ if ( $weight > 2){ $newweight = 2; } else { $newweight = $weight ; } return $newweight ; } add_filter( 'iben_elta_filter_weight_order_metabox' , 'myweight' ); |
Στο παρακάτω παράδειγμα ορίζουμε το βάρος υπολογίζοντας το ύψος * πλάτος * βάθος / 5000 του κάθε προϊόντος της παραγγελίας. Θα χρησιμοποιηθεί η μεγαλύτερη τιμή. Είτε η ογκοχρέωση είτε το συνολικό βάρος.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | function iben_change_weight( $weight , $order_id ){ $order = wc_get_order( $order_id ); if ( ! is_a ( $order , 'WC_Order' ) ){ return ; } $total_weight_dim = 0; $final_weight = 0; foreach ( $order ->get_items() as $item_id => $product_item ){ $quantity = $product_item ->get_quantity(); // get quantity $product = $product_item ->get_product(); // get the WC_Product object if ( $product ) { $height = ( $product ->get_height() >= 0 ? $product ->get_height() : 0); $width = ( $product ->get_width() >= 0 ? $product ->get_width() : 0); $length = ( $product ->get_length() >= 0 ? $product ->get_length() : 0); $total_weight_dim += $quantity * (( $height * $width * $length ) / 5000); } } //&& $weight != 0 if ( $total_weight_dim > $weight ){ $final_weight = $total_weight_dim ; } else { $final_weight = $weight ; } return $final_weight ; } add_filter( 'iben_elta_filter_weight_order_metabox' , 'iben_change_weight' , 10, 2); |
Εαν έχετε custom πεδίο στο checkout, πχ Κινητό και meta name είναι _billing_mobile κανένα πρόβλημα.
Σε άλλη περίπτωση εαν το custom πεδίο σας έχει διαφορετικό meta name τότε θα πρέπει να τρέξετε το παρακάτω κώδικα στο αρχείο chilld functions.php και απλά αλλάξτε το όνομα _billing_mobile με το δικό σας meta όνομα.
Η κάτω παύλα ( _ ) είναι απαραίτητη.
1 2 3 4 5 6 | function mycustomphonefield(){ return '_billing_mobile' ; } add_filter( 'iben_elta_filter_phone2_metafield_order_metabox' , 'mycustomphonefield' ); |
iben_elta_filter_comments_order_metabox
Για τα σχόλια / παρατηρήσεις του voucher
Σε κάποιες περιπτώσεις που χρησιμοποιείται μέθοδο πληρωμής (αντικαταβολή) από κάποιο άλλο plugin ή custom. Σε αυτή την περίπτωση το plugin δεν γνωρίζει εαν είναι αντικαταβολή και να προστεθεί αυτόματα στο πεδίο.
alg_custom_gateway_1 = Είναι το ID της μεθόδου πληρωμής
Το φίλτρο είναι διαθέσιμο για την έκδοση > v.1.6.0.1
1 2 3 4 5 6 7 | function iben_cash_delivery_add_alg_custom1(){ return $payments = array ( 'alg_custom_gateway_1' ); } add_filter( 'iben_elta_filter_cashdelivery_payments_order_metabox' , 'iben_cash_delivery_add_alg_custom1' ); |
Η παρακάτω συνάρτηση θα διορθώσει τα κινητά ή τα σταθερά τηλέφωνα σε 10 αριθμούς
πχ
+30 693 82 12 126 ->6938212126
+30 6938212126 ->6938212126
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // require >= 1.7.2 function iben_elta_change_phone_format( $phone ){ $country_code = '30' ; if ( $phone && strlen ( $phone ) > 10){ // remove spaces $phone = str_replace ( " " , "" , $phone ); // remove +30 $phone = preg_replace( "/^\+?{$country_code}/" , '' , $phone ); return trim( $phone ); } else { return $phone ; } } add_filter( 'iben_elta_phone_format' , 'iben_elta_change_phone_format' , 10); |
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Analytics" category . |
cookielawinfo-checkbox-functional | 1 year | The cookie is set by the GDPR Cookie Consent plugin to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Necessary" category . |
CookieLawInfoConsent | 1 year | Records the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie. |
elementor | never | This cookie is used by the website's WordPress theme. It allows the website owner to implement or change the website's content in real-time. |
Cookie | Duration | Description |
---|---|---|
_ga | 2 years | The _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors. |
_gat_gtag_UA_129335665_2 | 1 minute | Set by Google to distinguish users. |
_gid | 1 day | Installed by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously. |