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 | |
/** | |
* | |
* You can find the complete tutorial for this here: | |
* https://pluginrepublic.com/woocommerce-custom-fields | |
* | |
* Alternatively, check out the plugin | |
* https://pluginrepublic.com/wordpress-plugins/woocommerce-product-add-ons-ultimate/ | |
* |
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 | |
function prefix_filter_single_product_classes( $classes, $item ) { | |
$classes[] = 'my-new-class'; | |
return $classes; | |
} | |
add_filter( 'pewc_filter_single_product_classes', 'prefix_filter_single_product_classes', 10, 2 ); |
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
/** | |
* Filter the cart template path to use our cart.php template instead of the theme's | |
*/ | |
function csp_locate_template( $template, $template_name, $template_path ) { | |
$basename = basename( $template ); | |
if( $basename == 'cart.php' ) { | |
$template = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'templates/cart.php'; | |
} | |
return $template; | |
} |
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 | |
$args = array( | |
'label' => '', // Text in Label | |
'class' => '', | |
'style' => '', | |
'wrapper_class' => '', | |
'value' => '', // if empty, retrieved from post meta where id is the meta_key | |
'id' => '', // required | |
'name' => '', //name will set from id if empty |
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
function prefix_wishlist_template_location( $template_hook, $product_id ) { | |
// Return your hook here | |
return 'woocommerce_single_product_summary'; | |
} | |
add_filter( 'woocommerce_wishlists_template_location', 'prefix_wishlist_template_location', 10, 2 ); |
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 | |
function my_prefix_upload_mimes( $mimes ) { | |
// Add PhotoShop PSD files to list of permitted WordPress mime types | |
$mimes['psd'] = "application/x-photoshop"; | |
return $mimes; | |
} | |
add_filter( 'upload_mimes', 'my_prefix_upload_mimes' ); |
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 | |
function st_popular_posts_shortcode( $atts, $content ) { | |
$pop_posts = get_transient( 'st_popular_posts' ); | |
if( false === $pop_posts ) { | |
$args = apply_filters( 'showcase_filter_popular_posts', array( | |
'orderby' => 'comment_count', | |
'posts_per_page' => 4, | |
) ); | |
$pop_posts = new WP_Query( $args ); | |
set_transient( 'st_popular_posts', $pop_posts, WEEK_IN_SECONDS ); |
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 | |
$args = array( | |
'limit' => 9999, | |
'return' => 'ids', | |
'date_completed' => '2018-10-01...2018-10-10', | |
'status' => 'completed' | |
); | |
$query = new WC_Order_Query( $args ); | |
$orders = $query->get_orders(); | |
foreach( $orders as $order_id ) { |
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 | |
$order = wc_get_order( $order_id ); | |
$customer_id = $order->get_user_id(); |
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 | |
$order = wc_get_order( $order_id ); | |
echo $order->get_billing_email(); | |
echo $order->get_billing_first_name(); | |
echo $order->get_billing_last_name(); | |
echo $order->get_billing_address_1(); | |
echo $order->get_billing_address_2(); | |
echo $order->get_billing_postcode(); | |
echo $order->get_billing_state(); | |
echo $order->get_billing_country(); |
OlderNewer