wc-plugins-snippets icon indicating copy to clipboard operation
wc-plugins-snippets copied to clipboard

Remove the Shipping Address for virtual products

Open nicomputer opened this issue 3 years ago • 0 comments

I´m trying to remove the Shipping Address for virtual products with a snippet, but I´m totally not a pro in this. Can anyone support please how to code this? As a starting point I tried to use the "remove payment method" snippet which of course didn´t work:

/**

  • Removes "Shipping Address" from the header table of invoices
  • @param array $column array containing the column of the footer table
  • @param string $type the type of document being viewed
  • @param \WC_Order $order the order object the document is for
  • @return array $column the updated array */

function sv_wc_pip_document_table_footer( $column, $type, $order_id ) {

//bail if document type is not invoice
if ( 'invoice' !== $type ) { return $column; }

//remove payment method from array
if ( isset( $column['shipping-address'] ) ) {
	unset( $column['shipping-address'] );
}

return $column; //return updated array

} add_filter( 'wc_pip_document_table_footer', 'sv_wc_pip_document_table_footer', 10, 3 );

nicomputer avatar Jan 01 '22 16:01 nicomputer