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 | |
/** | |
* Form used for add to existing subscription from the single product page. | |
* | |
* @author Shop Plugins | |
* @category WooCommerce Subscriptions/Templates | |
* @version 2.0.1 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
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 | |
/** | |
* Send an email notification when a customer adds an item to their subscription. | |
* | |
* @param WC_Subscription $subscription | |
* @param WC_Product $product | |
* @param int $quantity | |
*/ | |
function sp_toolbox_notify_add( $subscription, $product, $quantity ) { | |
$to = ''; // recipient of the email |
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 | |
/** | |
* Form used for add to existing subscription from the single product page. | |
* | |
* @author Shop Plugins | |
* @category WooCommerce Subscriptions/Templates | |
* @version 2.0.1 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
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('sp_next_payment_time_of_day','sp_next_payment_time_of_day_change',10); | |
function sp_next_payment_time_of_day_change( $time ) { | |
return '09:00:00'; | |
} |
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 | |
/** | |
* Hooked into `jgtb_allow_edit_qty_for_subscription`, this will check | |
* the new quantity of items in the subscription and allow/disallow the | |
* edit. | |
* | |
* @param string $allowed 'yes' or 'no'. | |
* @param \WC_Subscription $subscription Instance of current subscription. | |
* @return string 'yes' or 'no'. |
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 | |
/** | |
* Bulk Refund Orders | |
* | |
* This script expects a csv file with following columns: | |
* - Order ID 1002 | |
* - Reason for refund 'Item was oversold.' | |
* - Amount to refund '34.56' | |
* - Refund payment true/false | |
* - Restock item true/false |
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 | |
/** | |
* Update next payment date for subscriptions. | |
* Run this script using WP CLI: | |
* $ wp eval-file update_next_payment.php | |
*/ | |
$subs = [ | |
// ids of subscriptions to update | |
]; |
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 | |
/** | |
* Send an email notification when a customer skips a subscription shipment. | |
* | |
* @param $subscription | |
* @param $user_id | |
* @param $old_next_date | |
* @param $next_payment_date | |
*/ |
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 | |
/** | |
* Hook into Pushover send notification on new order and add something to the title from order. | |
* | |
* @hook 'wc_pushover_notify_new_order' | |
* @param $args | |
* @return mixed | |
*/ | |
function sp_wc_pushover_notify_new_order( $args ) { |
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 | |
// Remove the list of products in a subscription with the quantity input | |
remove_action( 'woocommerce_my_subscriptions_after_subscription_id', 'Javorszky\Toolbox\add_list_of_items' ); | |
// Re-add the list of products without the quantity input. | |
add_action( 'woocommerce_my_subscriptions_after_subscription_id', 'sp_add_list_of_items' ); | |
function sp_add_list_of_items( $subscription ) { | |
echo '<ul>'; | |
foreach ( $subscription->get_items() as $item_id => $item ) { |
NewerOlder