Query shipping method
-
I love your plug in. I’m adding a custom field to the PDFs generated but I would like to query the shipping method and only show the field if the shipping is not pickup. This doesn’t seem to work, where am I going wrong? I’ve tried outputting the variable $shipping_method to see what it contains and it appears to be empty.
add_action( ‘wpo_wcpdf_before_order_details’, ‘wpo_wcpdf_location’, 10, 2 );
function wpo_wcpdf_location ($template_type, $order) {
$document = wcpdf_get_document( $template_type, $order );
$shipping_method = $order->get_shipping_method();
if ($shipping_method !== ‘local_pickup’) {
?>
<b>Delivery Location:</b> <?php $document->custom_field(‘Delivery Location’); ?><br><br>
<?php
}
}`
- The topic ‘Query shipping method’ is closed to new replies.