Skip to content

Instantly share code, notes, and snippets.

@sonipb
sonipb / woo-email.php
Created February 3, 2018 11:20 — forked from goranefbl/woo-email.php
Use woocommerce email template header/footer with your plugin
public function gens_send_email($user_id,$coupon_code) {
if ( !$user_id || !$coupon_code) {
return false;
}
global $woocommerce;
$mailer = $woocommerce->mailer();
$user_info = get_userdata($user_id);
@sonipb
sonipb / sale-flash.php
Created June 21, 2018 11:42 — forked from vividvilla/sale-flash.php
Display Discount/Offer percentage in WooCommerce
<?php
/**
* Product loop sale flash
*
* @author Vivek R @ WPSTuffs.com
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@sonipb
sonipb / wc-custom-sorting-options-asc-dec.php
Last active August 12, 2018 08:50 — forked from woogists/wc-custom-sorting-options-asc-dec.php
[Frontend Snippets] Custom sorting options to random (asc/desc)
/**
* Add custom sorting options (asc/desc)
*/
add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );
function custom_woocommerce_get_catalog_ordering_args( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'random_list' == $orderby_value ) {
$args['orderby'] = 'rand';
$args['order'] = '';
$args['meta_key'] = '';
@sonipb
sonipb / ultimate-guide-to-woocommerce-checkout-fields.html
Last active April 1, 2025 22:40
woocommerce checkout page : Ultimate Guide to WooCommerce Checkout Fields
// ref. https://jeroensormani.com/ultimate-guide-to-woocommerce-checkout-fields/
//This post is meant as a one stop shop if you’d like to make any kind of customizations to your WooCommerce checkout fields. Whether this is adding additional fields, removing some unneeded ones or changing the order they’re displayed in.
This post is meant as a one stop shop if you’d like to make any kind of customizations to your WooCommerce checkout fields. Whether this is adding additional fields, removing some unneeded ones or changing the order they’re displayed in.
Additionally there will be guides on how do display fields two field side by side, updates the order totals when a field changes and how to add basic field validation.
This is a post with a lot of code snippets and likely requires changes for it to fit your exact needs. Prefer to use a plugin instead? Take a look at my Advanced Checkout Fields for WooCommerce plugin.
Good to Know
These are some good to know files, hooks and functions/methods. Some of these
@sonipb
sonipb / gist:8da1a7c445ed2a93129aaf93544f7555
Created September 21, 2018 19:20
web site offline message
In order to give you better experience, our Shop section shall be undergoing maintenance during 12:00 AM – 06:00 AM on 22nd September. Recharge and bill payment facilities shall be unavailable during this time. Kindly visit us after 6:00 AM to recharge or pay bills.
While this is happening, rest of the website is at your disposal to explore and enjoy.
We will surely miss you. Please bear with us for a few hours in order to serve you better. Many apologies for the inconvenience www.vodafone.in