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: Add delivery date to export | |
| * 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 | |
| // for troubleshooting specific site. | |
| add_action( 'wp', 'get_subs_by_products' ); | |
| function get_subs_by_products() { | |
| $product_ids = array(39002, 39001, 27181, 26017, 73821, 4178); | |
| $subscriptions = wcs_get_subscriptions( array( 'product_id' => $product_ids, 'subscriptions_per_page' => -1, 'subscription_status' => array( 'wc-active', 'wc-on-hold' ) ) ); | |
| $number_of_subs = count($subscriptions); |
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; |