This file contains hidden or 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
This is used to formate the debuging mode of the MAMP. | |
Here we need to enable the xdebug module in mamp in php ini file. | |
There are two different php ini file in, The locations are following. | |
/Applications/MAMP/bin/php/php7.3.8/conf/php.ini ---- In bin folder | |
/Applications/MAMP/conf/php7.3.8/php.ini ---- In conf folder | |
In bin folder open php.ini file and uncomment the line | |
zend_extension="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so" |
This file contains hidden or 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
add_filter( 'woocommerce_email_customer_details_fields', 'add_user_id_to_woocommerce_emails', 10, 3); | |
function add_user_id_to_woocommerce_emails( $fields, $sent_to_admin, $order ) { | |
$user_id = $order->get_customer_id(); | |
$user_info = get_userdata( $user_id ); | |
$fields['user_id'] = array( | |
'label' => __( 'User ID', 'woocommerce' ), | |
'value' => $user_id | |
); |
This file contains hidden or 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 | |
/* | |
Plugin Name: Conditionally send WooCommerce emails | |
Plugin URI: https://www.damiencarbery.com/2018/12/conditionally-disable-woocommerce-emails/ | |
Description: Dynamically determine whether to send a WooCommerce email. | |
Author: Damien Carbery | |
Version: 0.2 | |
*/ | |
// The filter name is 'woocommerce_email_enabled_'.WC_Email::id e.g. 'new_order', 'cancelled_order' etc |
This file contains hidden or 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
$(document).ready(function(){ | |
$("#id_country_code").change(function(){ | |
var option = $(this).val(); | |
$.ajax({ | |
type: "GET", | |
url: "/models/get", | |
data:{ | |
key: option | |
}, | |
success: function(response){ |
This file contains hidden or 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
1. Install SMTP Plugins | |
https://wordpress.org/plugins/search/SMTP/ | |
2. Configure Plugins | |
* Outgoing Mail (SMTP) Server: smtp.gmail.com | |
* Use Authentication: Yes | |
* Use Secure Connection: Yes (TLS or SSL) | |
* Username: your Gmail account (e.g. [email protected]) |
This file contains hidden or 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
add_action( 'woocommerce_email_after_order_table', 'add_trustpilot_afs_tracking', 20, 2 ); | |
function add_trustpilot_afs_tracking( $order, $sent_to_admin ) { | |
if ( ! $sent_to_admin ) { | |
?> | |
<script type="application/json+trustpilot"> | |
{ | |
"recipientEmail": "<?php echo $order->billing_email; ?>", | |
"recipientName": "<?php echo $order->billing_first_name.' '. $order->billing_last_name; ?>", | |
"referenceId": "<?php echo $order->get_order_number(); ?>", | |
"products": [<?php |
This file contains hidden or 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 | |
/** | |
* Pre-populate Woocommerce checkout fields | |
* Note that this filter populates shipping_ and billing_ fields with a different meta field eg 'first_name' | |
*/ | |
add_filter('woocommerce_checkout_get_value', function($input, $key ) { | |
global $current_user; | |
switch ($key) : |
This file contains hidden or 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
function random_text( $type = 'alnum', $length = 8 ) | |
{ | |
switch ( $type ) { | |
case 'alnum': | |
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
break; | |
case 'alpha': | |
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
break; | |
case 'hexdec': |
This file contains hidden or 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
/** | |
* Add the field to the checkout | |
**/ | |
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); | |
function my_custom_checkout_field( $checkout ) { | |
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>'; | |
/** |