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 // do not copy this line | |
/** | |
* Will clear out all the specified completed scheduled actions, 5000 at a time. | |
*/ | |
function clear_woocommerce_scheduled_actions_20200609() { | |
global $wpdb; | |
$limit = 5000; | |
$actions_table = $wpdb->prefix . 'actionscheduler_actions'; | |
$logs_table = $wpdb->prefix . 'actionscheduler_logs'; |
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 // do not copy this line | |
/** | |
* Allows the editing of the PayPal Standard Subscription ID even if it shouldn't be edited. | |
* Use at own risk. | |
*/ | |
function jp_allow_edit_of_pp_standard_sub_payment_20200416( $payment_meta, $subscription ) { | |
// Make sure that what we're going to edit exists. | |
if ( isset( $payment_meta['paypal'] ) |
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 // do not copy this line | |
/** | |
* Simple filter to add the 'partial-payment' status to the order statuses that get pulled into | |
* default WooCommerce reports. | |
* | |
* @param arr $statuses The original statuses. | |
* @return arr The updated statuses. | |
* @link https://gist.github.com/jessepearson/5b1cb1192488a2b4421bd214ccf17d45 | |
*/ |
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 // do not copy this line | |
/** | |
* Simple filter to change the 'no_shipping' value from 1 to 2 with | |
* PayPal Standard in WooCommerce when no shipping is needed. | |
* | |
* @param arr $data The original data. | |
* @return arr The updated data. | |
* @link https://wordpress.org/support/topic/shipping-and-or-billing-address-not-being-sent-to-paypal-2/ | |
* @link https://gist.github.com/jessepearson/3c258df272e73db875e901c0909a3554 |
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 // do not copy this line | |
/** | |
* Simple filter to set the proper billing data for a customer in the post to PayPal Payflow. | |
* | |
* @param arr $data The original data. | |
* @return arr The updated data. | |
*/ | |
function jp_fix_buyer_billing_data_payflow( $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 // do not copy this line | |
/** | |
* Adds the product link to low and out of stock emails in WooCommerce | |
* @param string $message Message stating low/out of stock. | |
* @param object $product The product's object the email is for. | |
* @return string The modified email with the link to edit the product. | |
* | |
* @link https://wordpress.org/support/topic/admin-stock-notification-emails/ | |
* @link https://gist.github.com/jessepearson/701386d8ca5e4c84fc7cdf3d5d5391a3 |
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 // do not copy this line | |
if( ! function_exists( 'mc_child_custom_woocommerce_states' ) ) { | |
function mc_child_custom_woocommerce_states( $states ) { | |
$states['LK'] = array( | |
'LK1001' => __( 'Colombo 1', 'woocommerce' ), | |
'LK1002' => __( 'Colombo 2', 'woocommerce' ), | |
'LK1003' => __( 'Colombo 3', 'woocommerce' ), | |
'LK1004' => __( 'Colombo 4', 'woocommerce' ), |
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 // do not copy this line | |
function jp_dectivate_gutenberg_for_products( $can_edit, $post_type ){ | |
if( 'product' === $post_type ){ | |
$can_edit = ''; | |
} | |
return $can_edit; | |
} | |
add_filter( 'use_block_editor_for_post_type', 'jp_dectivate_gutenberg_for_products', 999, 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 // do not copy this line | |
/** | |
* Removes the payment instructions from the COD payment gateway in WooCommerce. | |
*/ | |
function jp_custom_remove_instructions(){ | |
if ( ! class_exists( 'WC_Payment_Gateways' ) ) { | |
return; | |
} |
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 // do not copy this line | |
/** | |
* Both functions below work the same, they just apply to categories and tags respectively. | |
* They exclude the defined IDs from being included in related products in WooCommerce. | |
* | |
* Note: The results are initially cached, so add this and then clear transients before saying it doesn't work. | |
* | |
* @link https://gist.github.com/jessepearson/dcf49d766cd1647465655fe9a14e51f2 | |
* @param [array] $categories/$tags The array of categories or tags that are being used for related products. |