Skip to content

Instantly share code, notes, and snippets.

View DanielSantoro's full-sized avatar

Danny Santoro DanielSantoro

View GitHub Profile
@DanielSantoro
DanielSantoro / autocomplete-virtual.php
Created June 5, 2017 16:32
Autocomplete Virtual Orders
add_filter( 'woocommerce_payment_complete_order_status', 'woocustom_autocomplete_virtual_orders', 10, 2 );
function woocustom_autocomplete_virtual_orders( $order_status, $order_id ) {
$order = wc_get_order( $order_id );
if ('processing' == $order_status && ('on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status)) {
$virtual_order = '';
if ( count( $order->get_items() ) > 0 ) {
foreach ( $order->get_items() as $item ) {
if ( 'line_item' == $item['type'] ) {
<?php
/**
* Simple product add to cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Simple Product Class.
*
* The default product type kinda product.
@DanielSantoro
DanielSantoro / email-styles.php
Created April 19, 2017 16:13
Email Styles in WC
<?php
/**
* Email Styles
*
* This template can be overridden by copying it to yourtheme/woocommerce/emails/email-styles.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@DanielSantoro
DanielSantoro / rating.php
Created April 6, 2017 14:38
Found at `woocommerce/templates/single-product/rating.php`
<?php
/**
* Single Product Rating
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/rating.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@DanielSantoro
DanielSantoro / example.php
Created April 5, 2017 22:07
Function with a priority of 10
<?php
/**
* Changes the redirect URL for the Return To Shop button in the cart.
*/
function wc_empty_cart_redirect_url() {
return 'http://example.com/category/specials/';
}
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url', 10 );
@DanielSantoro
DanielSantoro / example.php
Last active April 5, 2017 21:56
Function with a priority of 20
<?php
/**
* Changes the redirect URL for the Return To Shop button in the cart.
*/
function wc_empty_cart_redirect_url() {
return 'http://example.com/category/specials/';
}
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url', 20 );
@DanielSantoro
DanielSantoro / functions.php
Created March 24, 2017 15:36
Fixed Year in Storefront Footer Modification
function custom_storefront_credit() {
?>
<div class="site-info">
&copy; <?php echo get_bloginfo( 'name' ); ?> 2017
</div><!-- .site-info -->
<?php
}
@DanielSantoro
DanielSantoro / table.html
Last active February 28, 2017 15:52
TextExpander Top Snippets Table
<table>
<tbody>
<tr>
<th width="20%">Snippet to Type</th>
<th width="20%">Submitted By</th>
<th width="60%">Use Case/Returned Value</th>
</tr>
<tr>
<td><code></code></td>
<td></td>
@DanielSantoro
DanielSantoro / replacement.html
Created December 27, 2016 18:19
Your Replacement
There are no shipping methods available. Please double check your address, or <a href="http://www.nyccafeandcatering.com/contact/" target="_blank">contact us</a> if you need any help.