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
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 |
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
// 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 |
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 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'] = ''; |
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 | |
/** | |
* Product loop sale flash | |
* | |
* @author Vivek R @ WPSTuffs.com | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
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
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); |
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
// Get The Page ID You Need | |
get_option( 'woocommerce_shop_page_id' ); | |
get_option( 'woocommerce_cart_page_id' ); | |
get_option( 'woocommerce_checkout_page_id' ); | |
get_option( 'woocommerce_pay_page_id' ); | |
get_option( 'woocommerce_thanks_page_id' ); | |
get_option( 'woocommerce_myaccount_page_id' ); | |
get_option( 'woocommerce_edit_address_page_id' ); | |
get_option( 'woocommerce_view_order_page_id' ); | |
get_option( 'woocommerce_terms_page_id' ); |
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 | |
// Display variations dropdowns on shop page for variable products | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' ); | |
function woo_display_variation_dropdown_on_shop_page() { | |
global $product; | |
if( $product->is_type( 'variable' )) { | |
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
function wcs_redirect_product_based ( $order_id ){ | |
$order = wc_get_order( $order_id ); | |
foreach( $order->get_items() as $item ) { | |
$_product = wc_get_product( $item['product_id'] ); | |
// Add whatever product id you want below here | |
if ( $item['product_id'] == 70 ) { | |
// change below to the URL that you want to send your customer to | |
wp_redirect('http://www.yoururl.com/your-thank-you-page'); | |
} |
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
function lgbk_add_member( $order_id ) { | |
$order = new WC_Order( $order_id ); | |
$items = $order->get_items(); | |
foreach ( $items as $item ) { | |
$product_name = $item['name']; | |
$product_id = $item['product_id']; | |
$product_variation_id = $item['variation_id']; | |
} |
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 | |
function email_past_due() { | |
global $wpdb; | |
$mailer = WC_Emails::instance(); | |
$date = date( "Y-m-d H:i:s", current_time( 'timestamp' ) + 86400 * 7 ); | |
$due_orders = $wpdb->get_col( $wpdb->prepare( " | |
SELECT posts.ID | |
FROM {$wpdb->posts} AS posts |
NewerOlder