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
$csr = WC()->integrations->get_integration('woocommerce-cart-stock-reducer'); | |
$actual_stock = $csr->get_actual_stock_available( $product ); | |
$virtual_stock = $csr->get_virtual_stock_available( $product ); |
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( 'admin_init', 'woo_set_order_menu_default' ); | |
function woo_set_order_menu_default() { | |
global $submenu; | |
$original_menu = 'edit.php?post_type=shop_order'; | |
foreach ( $submenu['woocommerce'] as $id => &$menu ) { | |
if ( $menu[2] === $original_menu ) { | |
// Append post_status only to WooCommerce orders page | |
$menu[2] = $original_menu . '&post_status=wc-processing'; | |
} |
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( 'pods_roles_get_capabilities', 'temp_fix_for_gf_pods', 10, 1 ); | |
function temp_fix_for_gf_pods( $capabilities ) { | |
if ( version_compare( '2.7.15', PODS_VERSION, '<=' ) && is_callable( 'GFCommon::all_caps' ) ) { | |
$capabilities = array_merge( $capabilities, GFCommon::all_caps() ); | |
} | |
return $capabilities; | |
} |
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_after_shop_loop_item', 'jmg_woo_add_stock' ); | |
function jmg_woo_add_stock() { | |
global $product; | |
if ( $product->managing_stock() ) { | |
// Only on products with managed stock | |
echo wc_get_stock_html( $product ); | |
} | |
} |
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( 'pods_pod_form_success_message', 'jmg_success_message' ); | |
function jmg_success_message( $message ) { | |
return 'So long and thanks for all the fish!'; | |
} |
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_product_backorders_require_notification', 'jmg_backorders_notification', 10, 2 ); | |
function jmg_backorders_notification( $notify, $product = null ) { | |
if ( $product && 'notify' === $product->get_backorders() && $product->is_in_stock() ) { | |
return false; | |
} | |
return $notify; | |
} |
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 | |
namespace Example\DownloadMonitor; | |
/** | |
* Force DownloadMonitor WordPress plugin to handle tags + exclude_tags attributes the same was as Category is | |
* Duplicates behavior of https://github.com/download-monitor/download-monitor/pull/488 | |
* without requiring patching the code. This will be unnecessary if the PR gets committed | |
*/ | |
class Shortcodes { |
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_helper_suppress_admin_notices', 'jmg_woocommerce_helper_suppress_admin_notices' ); | |
// Don't show the 'Connect your store to WooCommerce.com to receive extensions updates and support.' nag | |
function jmg_woocommerce_helper_suppress_admin_notices( $default ) { | |
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
add_action( 'init', 'woo_add_to_cart_fixup' ); | |
function woo_add_to_cart_fixup() { | |
// Duplicate WooCommerce variation attributes from $_GET to $_POST because WC_Form_Handler->add_to_cart_handler_variable only looks in $_POST | |
if ( isset( $_GET, $_GET['add-to-cart'] ) ) { | |
foreach ( $_GET as $key => $value ) { | |
if ( false !== strpos( $key, 'attribute' ) ) { | |
$_POST[ $key ] = $value; | |
} | |
} | |
} |
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 | |
/** | |
* Name: CPT Admin Fields | |
* | |
* Description: Allow adding fields to the CPT editor table. | |
* | |
* Version: 2.3 | |
* | |
* Category: Advanced | |
* |
NewerOlder