Condition prefix based on product category
-
I want to modify the invoice prefix based on specific Product category. If its possible the count number exit from the normal loop. (I dont care the number)
I have a little code, but doesnt work. I modified but never work.
add_filter('wpo_wcpdf_document_number_settings','wpo_wcpdf_document_number_variable_prefix',10,2); function wpo_wcpdf_document_number_variable_prefix( $number_settings, $document ) { if (!empty($document->order) && $document->get_type() == 'invoice') { $billing_country = $document->order->get_billing_country(); $eu_countries = WC()->countries->get_european_union_countries('eu_vat'); $is_eu_country = in_array($billing_country, $eu_countries); if ($billing_country == 'ES') { // Customer from Spain $number_settings['prefix'] = "ES/"; } elseif($is_eu_country) { // Customer from another EU country $number_settings['prefix'] = "EU/"; } } return $number_settings; }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Condition prefix based on product category’ is closed to new replies.