This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Run action each time a object tracking information is updated (not recommended unless you need to diferentiate each object) | |
* | |
* @param int $order_id The order ID | |
* @param string $tracking_number The object tracking number | |
* @param array $tracking_information An array will all objects traking information (the key is the tracking number) | |
* @param bool $programmatically If the udpate was triggered programmatically | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$token = apply_filters( 'woo_dpd_portugal_get_token', null ); | |
if ( $token['success'] ) { | |
// Do your thing with $token['token'] | |
var_dump( $token['token'] ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Add this to you (child-)theme functions.php file, on a (mu-)plugin or with a plugin like Code Snippets https://wordpress.org/plugins/code-snippets/ */ | |
/* This only works with the classic checkout */ | |
add_filter( 'shop_as_client_pro_customer_data', 'my_shop_as_client_pro_customer_data', 10, 3 ); | |
function my_shop_as_client_pro_customer_data( $data, $customer = null, $order = null ) { | |
//Are we getting a "customer" object? | |
if ( $customer ) { | |
//Custom checkout field with id "billing_xpto" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Need help? Hire us: https://www.webdados.pt/contactos/ */ | |
//We need to wait for the page to be ready, or else the Consent platform may not be loaded yet, and we'll fire the pageview earlier than we should | |
window.onload = function() { | |
var google_analytics_id = 'UA-111111-01'; //Replace with yours | |
//Prepare the data layer | |
window.dataLayer = window.dataLayer || [] | |
//gtag function | |
function gtag() { | |
dataLayer.push(arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Set the product assembly cost to 5 on two specific products - https://wordpress.org/plugins/product-assembly-cost/ */ | |
add_filter( 'product_assembly_cost', function( $cost, $product_or_variation ) { | |
if ( $product_or_variation->get_id() == 17536 || $product_or_variation->get_id() == 16932 ) { // Set whatever condition you want here | |
$cost = 5; | |
} | |
return $cost; | |
}, 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Also show the user email on the WooCommerce order notes */ | |
add_filter( 'woocommerce_get_order_note', function( $note, $data ) { | |
if ( $note['added_by'] !== 'system' ) { | |
$note['added_by'] .= ' (' . $data->comment_author_email . ')'; | |
} | |
return $note; | |
}, 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'moloni_after_close_document', 'moloni_store_at_code' ); | |
/* Store Moloni AT Code - https://wordpress.org/support/topic/codigo-at-no-meta-da-encomenda/ */ | |
function moloni_store_at_code( $document_builder ) { | |
// Only for "Guias de Transporte" | |
if ( $document_builder->documentType != 'billsOfLading' ) { | |
return $document_builder; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Change item properties | |
add_filter( 'invoicexpress_woocommerce_document_item', function( $item_data, $item, $product, $order_object, $document_type, $args ) { | |
// Do whatever you want with the $item_data array, for example, change its reference or description | |
$item_data['name'] = 'whatever'; | |
/ /Or add somthing to its description | |
$item_data['description'] .= 'whatever'; | |
// And return it | |
return $item_data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'authenticate', function( $user, $username ) { | |
return new WP_Error( 'foo', 'This account is disabled' ); | |
}, 10, 2 ); |
NewerOlder