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 | |
/** | |
* Automatically delete "Stranded" products. | |
* | |
* REMOVE CODE AFTER STRANDED PRODUCTS SUCCESSFULLY DELETED!!! | |
*/ | |
add_action( 'init', function () { | |
global $wpdb; |
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 | |
function mycode_add_product_id_as_tracking_id( $tracking_id, $product ) { | |
return wc_get_product_id_by_sku( $product['_id'] ); | |
} | |
add_filter( 'dfrapi_tracking_id', 'mycode_add_product_id_as_tracking_id', 20, 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 | |
function mycode_auto_update_product_lookup_table_schedules( $array ) { | |
$array['mycode_update_lookup_table_schedule'] = [ | |
'interval' => HOUR_IN_SECONDS, | |
'display' => __( 'MyCode Update Product Lookup Table Cron Schedule', 'mycode' ), | |
]; | |
return $array; | |
} |
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 | |
/** | |
* Prevent taxonomy-based attributes from being overwritten when a Product Set | |
* updates a product already in your store. | |
* | |
* @see wc_get_product_terms() | |
* @link http://stackoverflow.com/a/13454788/2489248 | |
* | |
* @param array|string $value The current value of the $attribute for this $post. |
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 | |
/** | |
* Class Mycode_Replace_Missing_Images_With_External_Images | |
* | |
* Replaces any placeholder images with hotlinked image from merchant's server. | |
* | |
* @since 1.0.0 | |
*/ | |
class Mycode_Replace_Missing_Images_With_External_Images { |
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 | |
/** | |
* Adds a new cron interval to the cron $schedules array. | |
* | |
* @param array $schedules | |
* | |
* @return array | |
*/ | |
function mycode_my_custom_cron_schedules( $schedules ) { |
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 | |
/** | |
* Display product fields before the "buy" button on single product page. | |
* | |
* @global WC_Product $product | |
*/ | |
function mycode_display_extra_data_on_single_product_page() { | |
global $product; |
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 | |
/** | |
* Display product fields before the product's title in the Loop. | |
* | |
* @global WC_Product $product | |
*/ | |
function mycode_display_extra_data_in_loop() { | |
global $product; |
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 the product's Age Group as an attribute. | |
* | |
* The attribute 'Age Group' with a slug of 'age-group' must already exist here: WordPress Admin Area > Products > Attributes | |
* | |
* @param array|string $value The current value of the $attribute for this $post. | |
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size | |
* @param array $post An array of post data including ID, post_title, post_status, etc... |
NewerOlder