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
type FilterOperator = 'AND' | 'OR'; | |
type FiltersBy<T> = { | |
[K in keyof T]?: (value: T[K]) => boolean; | |
}; | |
/** | |
* Factory function that creates a specialized function to filter | |
* arrays, by validating all filters (AND operator), | |
* or validating just one of the filters (OR operator). | |
* @param operator Method to validate all filters: AND, OR |
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 | |
/* | |
WooCommerce has a handy feature in the admin UI to "Create variations from all attributes". | |
To do this programmatically (as of WooCommerce v3.7.0) use a modified version of link_all_variations() found in woocommerce/includes/class-wc-ajax.php | |
*/ | |
function myplugin_create_variations($product_id){ | |
wc_maybe_define_constant( 'WC_MAX_LINKED_VARIATIONS', 50 ); | |
wc_set_time_limit( 0 ); |
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
/** | |
* External dependencies | |
*/ | |
const { isUndefined, pickBy } = lodash; | |
/** | |
* WordPress dependencies | |
*/ | |
const { | |
registerBlockType, |