Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:11
Modify document billing address title using - WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee
add_filter('wf_alter_billing_address_label','wt_alter_billing_address_label',10,1);
function wt_alter_billing_address_label($text){
return $text = 'Shipping Address';
}
@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:12
Hide shipping address on Dispatch Label using - WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee
add_filter('wf_pklist_modify_shipping_address','wt_pklist_modify_shipping_address',10, 3);
function wt_pklist_modify_shipping_address($address, $order, $document_type){
if($document_type=='dispatchlabel'){
?>
<style>
#wf_shipping_address_title_main{
display: none;
@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:13
Change shipping From address to ship To address using - - WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee
add_filter('wf_alter_shipping_from_address','wt_alter_shipping_from_address',10, 3);
function wt_alter_shipping_from_address($address, $document_type, $order){
if($document_type=='dispatchlabel'){
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id();
$fromaddress = array();
$countries = new WC_Countries;
$shipping_country = get_post_meta($order_id, '_shipping_country', true);
@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:15
Change shipping To address to From address using - WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee
// Convert Dispatch Label into a Return Label
add_filter('wf_pklist_modify_billing_address','wt_pklist_modify_billing_address',10, 3);
function wt_pklist_modify_billing_address($address, $order, $document_type){
if($document_type=='dispatchlabel'){
$billing_address['first_name'] = stripslashes(get_option('woocommerce_wf_packinglist_sender_name'));
$billing_address['last_name'] = '';
@webtoffee-git
webtoffee-git / functions.php
Last active June 22, 2021 09:36
Export and Import order meta created using WooCommerce Booking Plugin using - WebToffee Order Import Export plugin for WooCommerce
<?php
add_filter('wt_iew_alter_export_data', 'wt_iew_alter_export_booking_data', 10, 6);
function wt_iew_alter_export_booking_data($export_data, $offset, $is_last_offset, $file_as, $to_export, $csv_delimiter) {
if ($to_export == 'order') {
if (isset($export_data['head_data'])) {
$export_data['head_data']['meta:booking_items'] = 'meta:booking_items';
}
if (isset($export_data['body_data'])) {
foreach ($export_data['body_data'] as $ord_key => $ord_value) {
@webtoffee-git
webtoffee-git / functions.php
Last active May 12, 2020 06:42
Alter font-size in Address Label - using WebToffee Print Invoice and Packing Slip plugin for WooCommerce
add_filter('wf_pklist_add_custom_css','wt_pklist_add_custom_css_to_addresslabel',10,2);
function wt_pklist_add_custom_css_to_addresslabel($custom_css,$template_type)
{
if($template_type=='addresslabel')
{
$custom_css.='.wfte_addr_col { font-size:18px; border:none; }';
}
return $custom_css;
}
@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:19
Modify WC API Manager details after migrating order license details using Order Import Export plugin for WooCommerce by WebToffee
global $wpdb;
if(!empty($_GET['mark-license-migration-update'])){
$new_order_from_wf = $wpdb->get_results("SELECT post_id FROM ".$wpdb->postmeta." WHERE meta_key = '_wt_import_key'");
foreach ($new_order_from_wf as $xa_order) {
//$xa_order->post_id = 20635;
$order_key = $wpdb->get_row("SELECT * FROM ".$wpdb->postmeta." WHERE meta_key = '_order_key' AND post_id = $xa_order->post_id"); // This query is not returning order key from server but this is running in local
$order_key_xa = $order_key->meta_value;
@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:21
Add Save and Accept button to the setting popup - WebToffee GDPR Cookie Consent plugin
/* add 'save & accept' button to settings popup using GDPR Cookie Consent plugin:::::start */
function cli_script_patch()
{
?>
<script type="text/javascript">
jQuery(document).ready(function(){
setTimeout(function(){
var cli_popup_row=jQuery('.cli-row');
cli_popup_row.append('<div class="cli_popup_footer"></div>');
var cli_popup_footer=jQuery('.cli_popup_footer');
@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:22
Display CookieBar as popup using - WebToffee GDPR Cookie Consent plugin
/* CLI bar as popup start */
add_action( 'wp_head', 'cookie_law_info_bar_as_popup' );
function cookie_law_info_bar_as_popup()
{
?>
<script type="text/javaScript">
function cookie_law_info_bar_as_popup()
{
@webtoffee-git
webtoffee-git / functions.php
Created February 13, 2020 06:24
Redirect "Read More" link according to the site language - WebToffee GDPR Cookie Consent plugin.
function wt_readmore_link_change_settings($settings) {
if($settings['button_x_text'] == 'Read More'){
$settings['button_x_url'] = 'https://www.webtoffee.com/';
}
if($settings['button_x_text'] == 'Weiterlesen'){
$settings['button_x_url'] = 'https://www.webtoffee.com/de';
}