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 | |
// get next and prev products | |
// Author: Georgy Bunin ([email protected]) | |
// forked from https://gist.github.com/2176823 | |
function ShowLinkToProduct($post_id, $categories_as_array, $label) { | |
// get post according post id | |
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array( | |
array( | |
'taxonomy' => 'product_cat', |
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_filter( 'manage_edit-shop_order_columns', 'woo_order_weight_column' ); | |
function woo_order_weight_column( $columns ) { | |
$columns['total_weight'] = __( 'Weight', 'woocommerce' ); | |
return $columns; | |
} | |
add_action( 'manage_shop_order_posts_custom_column', 'woo_custom_order_weight_column', 2 ); | |
function woo_custom_order_weight_column( $column ) { | |
global $post, $woocommerce, $the_order; |
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 | |
// hide coupon field on cart page | |
function hide_coupon_field_on_cart( $enabled ) { | |
if ( is_cart() ) { | |
$enabled = false; | |
} | |
return $enabled; |
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 an order notes section to customers' completed emails | |
add_action( 'woocommerce_email_after_order_table', 'wc_add_order_notes_to_completed_emails', 10, 1 ); | |
function wc_add_order_notes_to_completed_emails( $order ) { | |
if ( 'completed' == $order->status ) { | |
echo '<h2>' . __( 'Order Notes', 'woocommerce' ) . '</h2>'; | |
$order_notes = $order->get_customer_order_notes(); | |
foreach ( $order_notes as $order_note ) { | |
echo '<p>' . $order_note->comment_content . '<p>'; | |
} |
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 "Create an account?" section to customer emails | |
* Only added for emails sent to guest purchases | |
* | |
* @param \WC_Order $order the order object | |
* @param bool $sent_to_admin false if emails are sent to customers | |
* @param bool $plain_text false for HTML emails | |
*/ | |
function sv_add_email_register_section( $order, $sent_to_admin, $plain_text ) { |
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 | |
// get the email param if it's set so the registration form can use it | |
function sv_get_account_email_param() { | |
$_POST['email'] = isset( $_GET['email'] ) ? urldecode( $_GET['email'] ) : false; | |
} | |
add_action( 'woocommerce_register_form_start', 'sv_get_account_email_param' ); |
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 // only copy this line if needed | |
/** | |
* Adds product images to the WooCommerce order emails table | |
* Uses WooCommerce 2.5 or newer | |
* | |
* @param string $output the buffered email order items content | |
* @param \WC_Order $order | |
* @return $output the updated output | |
*/ | |
function sww_add_images_woocommerce_emails( $output, $order ) { |
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
add_filter('manage_edit-shop_order_columns', 'wc_custom_purchased_column'); | |
function wc_custom_purchased_column($columns) | |
{ | |
$new_array = array(); | |
foreach ($columns as $key => $title) { | |
if ($key == 'billing_address') { | |
$new_array['order_items'] = __('Purchased', '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 | |
/** Add a Purchased Column w/ Item Quantity, SKU, Name, & Meta to the Admin Orders Table **/ | |
class ThemeWooCommerce | |
{ | |
/* Add a `Purchased` Column to the Admin Orders Table */ | |
public static function add_purchased_column_header($columns) { | |
$new_columns = array(); | |
foreach ($columns as $key => $title) { | |
if ($key === 'billing_address') { | |
$new_columns['order_items'] = __('Purchased', '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 | |
/** | |
* I've published a fully-tested Composer library with type-casting. | |
* @see https://github.com/simivar/reverse-print-r | |
*/ | |
/** | |
* Matt: core | |
* Trixor: object handling | |
* lech: Windows suppport |
OlderNewer