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 | |
add_filter( 'woocommerce_new_customer_data', 'customer_username_based_on_email', 20, 1 ); | |
function customer_username_based_on_email( $new_customer_data ){ | |
// get the first billing name | |
if(isset($_POST['billing_email'])) $billing_email = $_POST['billing_email']; | |
if( ! empty($billing_email) && ! in_array( $_POST['billing_email'] ) ){ | |
// Replacing 'user_login' in the user data array, before data is inserted |
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: Sub Expired Email Send to Customer | |
* Plugin URI: | |
* Description: | |
* Version: 1.0 | |
* Author: | |
* Author URI: | |
**/ |
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 | |
add_action( 'valid-paypal-standard-ipn-request', 'test_handle_paypal_ipn_and_record_response', - 1 ); | |
function test_handle_paypal_ipn_and_record_response( $posted ) { | |
WC_Gateway_Paypal::log( 'Data collected from IPN' . wc_print_r( $posted, true ) ); | |
} |
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 | |
//DB details | |
$dbHost = 'localhost'; | |
$dbUsername = 'root'; | |
$dbPassword = 'root'; | |
$dbName = 'local'; | |
$dbPrefix = 'wp'; | |
//Create connection and select DB | |
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName); |
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 | |
function remove_cancel_gifted_subs( $actions, $subscription ) { | |
if ( WCS_Gifting::is_gifted_subscription( $subscription ) ) { | |
foreach ( $actions as $action_key => $action ) { | |
switch ( $action_key ) { | |
case 'cancel': // Hide "Cancel" button on subscriptions that are "active" or "on-hold"? | |
unset( $actions[ $action_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
<?php // don't copy this line | |
add_filter( 'wcs_can_items_be_removed', '__return_false' ); |
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 | |
add_filter( 'wc_order_is_editable', 'wc_make_all_orders_editable', 12, 2 ); | |
function wc_make_all_orders_editable( $is_editable, $order ) { | |
return true; | |
} |
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 | |
// Set the product discount amount to zero if it has a recurring scheme | |
add_filter( 'woocommerce_coupon_get_discount_amount', 'zero_discount_for_excluded_products', 12, 5 ); | |
function zero_discount_for_excluded_products( $discount, $discounting_amount, $cart_item, $single, $coupon ){ | |
if ( false != ( $cart_item[ 'wcsatt_data' ][ 'active_subscription_scheme' ] ) ) | |
$discount = 0; |
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: WooCommerce Subscriptions - Allow Same Product Switch | |
* Plugin URI: | |
* Description: Allow switching to same product for WooCommerce Subscriptions | |
* Version: 1.0 | |
* Author: Nick Green | |
* Author URI: | |
**/ |
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 | |
/** | |
* Function to set a max cap on the shipping rates. | |
*/ | |
function my_max_limit_shipping_rates_function( $rates, $package ) { | |
$methods = WC()->shipping()->get_shipping_methods(); | |
$shipping_limit = 15; // The maximum amount would be $15 | |
// Loop through all rates | |
foreach ( $rates as $rate_id => $rate ) { | |
// Check if the rate is higher then a certain amount |