Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
webtoffee-git / functions.php
Created May 23, 2024 11:58
Code snippet to hide print button in my account order details page and order list page - By WebToffee ( WooCommerce PDF Invoice, Packing Slips, Delivery Notes and Shipping labels )
<?php //Do not copy this line of code
add_filter('wt_pklist_is_frontend_order_list_page_print_action','wt_hide_print_button_order_list_page',10,3);
function wt_hide_print_button_order_list_page($show_button, $template_type, $action)
{
if ( 'invoice' === $template_type ) {
if ( 'print' === $action ) {
$show_button = false;
}
}
@webtoffee-git
webtoffee-git / functions.php
Created May 21, 2024 06:39
Code to change the Arabic currency symbol to AED in English - By WebToffee
<?php //Do not add this line of code
add_filter('wt_pklist_alter_currency_symbol','wt_change_currency_symbol',10,5);
function wt_change_currency_symbol($wc_currency_symbol,$symbols,$user_currency,$order,$price)
{
if($user_currency=='AED')
{
$wc_currency_symbol=' AED ';
}
return $wc_currency_symbol;
}
@webtoffee-git
webtoffee-git / functions.php
Created May 16, 2024 06:42
This code is used to change the "incl. tax" text to "incl. VAT" in invoice document - By WebToffee
<?php //Do not add this line of code
//To remove incl_tax text from subtotal
add_filter('wf_pklist_alter_tax_inclusive_text','wf_pklist_remove_tax_text',10,3);
function wf_pklist_remove_tax_text($incl_tax_text, $template_type, $order)
{
if($template_type=='invoice')
{
$incl_tax_text='incl. VAT';
}
return $incl_tax_text;
@webtoffee-git
webtoffee-git / function.php
Created May 9, 2024 12:20
to alter/translate the 'Print Invoice' button string present on the WooCommerce email
<?php //Do not add this line of code
add_filter("wt_pklist_alter_document_button_label","wt_pklist_alter_document_button_label_email",10,4);
function wt_pklist_alter_document_button_label_email($print_btn_label,$print,$loco,$template_type){
if( 'invoice' === $template_type ){
if( 'email' === $loco ){
$print_btn_label = __("Print your Invoice","print-invoices-packing-slip-labels-for-woocommerce");
}
}
@webtoffee-git
webtoffee-git / function.php
Created May 7, 2024 10:42
Code to Highlight/Change Item name Color if the quantity is two or more in the WooCommerce PDF invoice plugin - By WebToffee
<?php //Do not copy this line of code
add_filter('wf_pklist_alter_product_name', 'wt_pklist_new_prodct_name', 10, 5);
function wt_pklist_new_prodct_name($order_item_name, $template_type, $_product, $order_item, $order)
{
if( 'invoice' === $template_type ){
$qty = $order_item->get_quantity();
if( $qty >= 2 ){
$order_item_name = '<span style="color: red;" >'.$order_item_name.'</span>';
}
@webtoffee-git
webtoffee-git / function.php
Created May 2, 2024 11:03
Code to Highlight/Change Item name Color in the WooCommerce PDF invoice plugin - By WebToffee
<?php //Do not add this line of code
add_filter('wf_pklist_alter_product_name', 'wt_pklist_new_prodct_name', 10, 5);
function wt_pklist_new_prodct_name($order_item_name, $template_type, $_product, $order_item, $order)
{
if( 'invoice' === $template_type ){
$order_item_name = '<span style="color: red;" >'.$order_item_name.'</span>';
}
return $order_item_name;
}
@webtoffee-git
webtoffee-git / function.php
Created April 25, 2024 05:19
Code for Changing Item Quantity Color in WooCommerce Invoice document - By WebToffee ( WooCommerce PDF Invoice, Packing Slips, Delivery Notes and Shipping labels (free) )
<?php> //Do not copy this line of code
add_filter('wf_pklist_alter_item_quantiy', 'wt_alter_invoice_quantiy', 10 , 5);
function wt_alter_invoice_quantiy($item_quantity, $template_type, $_product, $item, $order)
{
if( 'invoice' === $template_type )
{
if( $item_quantity>1 )
{
$item_quantity = '<span style="color:red;">'.$item_quantity.'</span>';
}
@webtoffee-git
webtoffee-git / functions.php
Last active April 17, 2024 11:24
Code to add border to the invoice pdf - By WebToffee ( WooCommerce PDF Invoice, Packing Slips, Delivery Notes and Shipping labels )
<?php //Do not copy this line of code
add_filter('wf_pklist_add_custom_css','wt_pklist_alter_border_style',10,2);
function wt_pklist_alter_border_style($custom_css,$template_type)
{
if( 'invoice' === $template_type )
{
$custom_css.='body{ margin:30px !important; border:1px solid #000; }';
}
return $custom_css;
}
@webtoffee-git
webtoffee-git / functions.php
Last active April 18, 2024 06:41
Code to to remove incl. tax text from subtotal and total - By WebToffee
<?php //Do not copy this line of code
add_filter('wf_pklist_alter_find_replace','wt_pklist_show_order_total' ,10,6);
function wt_pklist_show_order_total($find_replace, $template_type, $order, $box_packing, $order_package, $html)
{
if( 'invoice' === $template_type )
{
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id();
$user_currency = get_post_meta($order_id, '_order_currency', true);
$total_price = (WC()->version< '2.7.0' ? $order->order_total : get_post_meta($order_id,'_order_total',true));
if( !empty( $total_price ) )
@webtoffee-git
webtoffee-git / function.php
Created April 11, 2024 07:35
Code to restrict Google ATP's - By WebToffee
<?php //Do not copy this line of code
add_filter('wt_cli_excluded_google_vendor_list','wt_excluded_google_vendor_list');
function wt_excluded_google_vendor_list($vendor_list){
return array('61');//key for restrict the provider_id
}