Skip to content

Instantly share code, notes, and snippets.

@aderaaij
aderaaij / wc-reorder-fields.php
Last active November 12, 2017 15:34
Customizing Checkout Field Order http://wordimpress.com/15-woocommerce-code-snippets-im-thankful-for/ Sometimes the default ordering of fields isn’t optimal for your business. You can modify the order the fields appear by customizing the following function:
<?php
add_filter( 'woocommerce_checkout_fields', 'reorder_woo_fields' );
function reorder_woo_fields( $fields ) {
//move these around in the order you'd like
$fields2['billing']['billing_first_name'] = $fields['billing']['billing_first_name'];
$fields2['billing']['billing_last_name'] = $fields['billing']['billing_last_name'];
$fields2['billing']['billing_company'] = $fields['billing']['billing_company'];
$fields2['billing']['billing_address_1'] = $fields['billing']['billing_address_1'];
$fields2['billing']['billing_address_2'] = $fields['billing']['billing_address_2'];
<?php
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
@aderaaij
aderaaij / wc-remove-breadcrumbs.php
Created July 24, 2014 08:28
Remove Woocommerce breadcrumbs
<?php
//remove Breadcrumbs
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
@aderaaij
aderaaij / wc-remove-result-count.php
Created July 24, 2014 08:55
Remove result count (in archive or after ordering)
<?php
// remove woocommerce result count
function woocommerce_result_count() {
return;
}
@aderaaij
aderaaij / wc-remove-sku.php
Created July 24, 2014 09:53
Remove SKU from product page
<?php
/**
* Remove "SKU" from product details page.
*/
add_filter( 'wc_product_sku_enabled', 'mycode_remove_sku_from_product_page' );
function mycode_remove_sku_from_product_page( $boolean ) {
if ( is_single() ) {
$boolean = false;
}
@aderaaij
aderaaij / wc-remove-quantity.php
Created July 24, 2014 10:06
Remove quantity selector
<?php
/**
* @desc Remove in all product type
*/
function wc_remove_all_quantity_fields( $return, $product ) {
return true;
}
add_filter( 'woocommerce_is_sold_individually', 'wc_remove_all_quantity_fields', 10, 2 );
@aderaaij
aderaaij / wc-remove-add-to-cart.php
Created July 24, 2014 12:57
Remove add to cart on archive loop
<?php
add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );
function remove_add_to_cart_buttons() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}
@aderaaij
aderaaij / functions.php
Last active November 12, 2017 15:35
Default functions.php
<?php
require_once('includes/-.php');
require_once('includes/-.php');
require_once('includes/-.php');
require_once('includes/-.php');
@aderaaij
aderaaij / setup.php
Last active November 12, 2017 15:35
Functions setup
<?php
if ( ! isset( $content_width ) )
$content_width = 674; /* pixels */
if ( ! function_exists( 'oms_setup' ) ):
function oms_setup() {
@aderaaij
aderaaij / thumbnails.php
Last active November 12, 2017 15:35
Post thumbnail support
<?php
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true );
add_image_size( 'thumb-585_320', 585, 320, true);
add_image_size( 'thumb-1920_1080', 1920, 1080, true);
}