• Resolved vibrations

    (@vibrations)


    hi

    i’m running an Australian webstore using WooCommerce PDF Invoices & Packing Slips Premium Templates, and i’d like to send pdf invoices to only Australian orders (needed to comply with our GST tax system), and not to international orders

    how would i make a filter to do this?
    i saw this post but am not sure how to apply to order country

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    That scripts is indeed a good start. Here’s how to adapt that for the billing country (Australia):

    
    add_filter( 'wpo_wcpdf_custom_attachment_condition', 'wpo_wcpdf_exclude_billing_country', 100, 4 );
    function wpo_wcpdf_exclude_billing_country( $condition, $order, $status, $document ) {
    	if ( $order->billing_country != 'AU' ) {
    		// don't creat invoice if billing coutry is not Australia (AU)
    		return false;
    	} else {
    		// else follow normal rules
    		return $condition;
    	}
    }
    

    Hope that helps!
    Ewout

    Thread Starter vibrations

    (@vibrations)

    thanks for replying!

    i tried the filter in code snippets, and it only sent email/PDF invoices for Australian orders

    international orders didn’t send a new customer order email to me, or an order confirmation to the customer

    the orders show up in the dashboard in woocommerce/orders though

    i tested with no other code snippets running, latest WP and woocommerce

    is there a different way to approach this?
    i’m selling to Japan as well as Australia, and don’t want to send jp customers giant 4-5mb pdf files using ipaexg or ipaexm fonts, or a pdf with little boxes instead of their Japanese address

    Plugin Contributor Ewout

    (@pomegranate)

    hi! Something must have gone wrong in copy pasting – this does not change anything in the emails itself unless the script crashes. It only tells the plugin whether or not to attach an invoice.

    For Japanese fonts you can enable font subsetting, that should greatly reduce the file size! The only thing you may want to also do is to disable the ‘uppercase’ on the document title, because this doesn’t work with subsetting:

    
    .document-type-label {
    	text-transform: none;
    }
    

    Ewout

    Thread Starter vibrations

    (@vibrations)

    yup, copy-paste error : )

    works fine now

    font subsetting is pretty impressive – looking at https://fontsubsetter.com/en-US
    it looks like the JP font size reduction is 88-98%
    i’ll definitely experiment with this later on

    thanks again for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disable Invoice by Country?’ is closed to new replies.