Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
}
@webtoffee-git
webtoffee-git / function.php
Created April 9, 2024 11:06
Code to change incl_tax text in Total and Subtotal to incl_GST - By WebToffee
<?php //Do not add this line of code
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. GST';
}
return $incl_tax_text;
}
@webtoffee-git
webtoffee-git / function.php
Created April 9, 2024 06:54
Code to remove the fee name from the invoice pdf - By WebToffee
<?php //Do not copy this line of code
add_filter('wf_pklist_alter_find_replace', 'wt_pklist_alter_total_fee', 10, 6);
function wt_pklist_alter_total_fee($find_replace, $template_type, $order, $box_packing, $order_package, $html) {
if ('invoice' === $template_type && !empty($order)) {
if (is_object($order)) {
$order_id = method_exists($order, 'get_id') ? $order->get_id() : $order->id;
$user_currency = get_post_meta($order_id, '_order_currency', true);
$fee_details = $order->get_items('fee');
if (!empty($fee_details)) {
@webtoffee-git
webtoffee-git / function.php
Created April 8, 2024 05:23
Code to remove the incl.tax text from the invoice pdf - By WebToffee (WooCommerce PDF Invoices, Packing Slips and Credit Notes)
<?php //Do not copy this line of code
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( 'invoice' === $template_type )
{
$incl_tax_text = '';
}
return $incl_tax_text;
}
@webtoffee-git
webtoffee-git / functions.php
Created April 3, 2024 10:30
To ensure compatibility with Points and Rewards for WooCommerce plugin by WP Swings (Smart Coupons For WooCommerce by WebToffee)
<?php //Do not copy this line of code
add_filter( 'wt_sc_alter_giveaway_cart_item_data_before_add_to_cart', function( $cart_item_data, $product_id, $variation_id, $quantity ){
if( isset( $cart_item_data['free_product'] ) && 'wt_give_away_product' === $cart_item_data['free_product'] ){
$_POST['wps_wpr_verify_cart_nonce'] = wp_create_nonce( 'wps-cart-nonce' );
}
return $cart_item_data;
}, 10, 4 );
@webtoffee-git
webtoffee-git / gist:1c7d2fc9c14e4acf5bacaf9083692acb
Created March 25, 2024 06:52
Code to adjust the product image size in the product table- By WebToffee (Print invoice free)
<?php //do not copy this line of code
add_filter('wt_pklist_alter_order_template_html','wf_pklist_alter_image_size',10,6);
function wf_pklist_alter_image_size($html, $template_type, $order, $box_packing, $order_package, $template_for_pdf)
{
if($template_type == 'invoice')
{
if(!empty($order))
{
$html.='<style>
.wfte_product_image_thumb
@webtoffee-git
webtoffee-git / function.php
Created March 21, 2024 04:20
Restricting Vendors on a IAB TCF Banner - By WebToffee (GDPR Cookie Consent plugin)
<?php //Do not add this line of code
add_filter('wt_cli_allowed_vendor_list','wt_alter_allowed_vendor_list');
function wt_alter_allowed_vendor_list($vendor_list){
return array('61','755');
}
@webtoffee-git
webtoffee-git / function.php
Created March 20, 2024 13:26
To change the position of delete button in wishlist table - By WebToffee (Wishlist for WooCommerce)
<?Php //Do not copy this line of code
add_action('wp_footer','wt_rp_wishlist_delete_btn',10);
function wt_rp_wishlist_delete_btn() {
?>
<script>
jQuery(document).ready(function (){
jQuery('.wt_frontend_wishlist_table tbody tr').each(function() {
var table_row = jQuery(this);