Skip to content

Instantly share code, notes, and snippets.

View sarangs07's full-sized avatar

Sarang Shahane sarangs07

  • Pune, Maharashtra.
View GitHub Profile
@sarangs07
sarangs07 / functions.php
Created April 7, 2020 12:23
Add Order details in the URL of thank you page
/*
* How to add the custome code.
*
* Please follow below instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
@sarangs07
sarangs07 / wc-am-hash.php
Created April 3, 2020 11:58
Download URL Expiry issue
public function add_hash( $user_id, $hash ) {
global $wpdb;
$hash_name = $this->generate_key( 12 );
// hash could contain up to 255 characters
$data = array(
'hash_user_id' => $user_id,
'hash_name' => $hash_name,
@sarangs07
sarangs07 / functions.php
Created March 31, 2020 08:20
Don't store the checkout fields data in the local storage.
/*
* How to add the custome code.
*
* Please follow below instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
@sarangs07
sarangs07 / functions.php
Last active April 13, 2020 05:35
Redirect to flow on click of add-to-cart button on product's single page
/*
* How to add the custome code.
*
* Please follow below instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
/* Redirect to flow on click of add-to-cart button on product's single page */
add_action( 'wp_head', 'ev_add_ev_code_in_head' );
function ev_add_ev_code_in_head(){
$head_code = '';
$post_type = get_post_type();
if( 'cartflows_step' === $post_type ){
if ( isset( $_GET['wcf-order'] ) && ! empty( $_GET['wcf-order'] ) ) {
$order = wc_get_order( filter_input( INPUT_GET, 'wcf-order', FILTER_SANITIZE_NUMBER_INT ) );
@sarangs07
sarangs07 / functions.php
Created March 17, 2020 07:16
Filter to add Product name as the query string/paramater in the Global Checkout URL
/*
* How to add the custome code.
*
* Please follow below instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
@sarangs07
sarangs07 / functions.php
Created March 11, 2020 13:48
Filter to hide the order_comments on the checkout page.
/*
* Code installation instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
/*
* Filter to hide the order_comments on the checkout page.
*/
@sarangs07
sarangs07 / functions.php
Last active June 26, 2020 10:06
Filter to change the Cron time which is set to auto-complete the order status.
/*
* Code installation instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
/**
* Filter to change the Cron time which is set to auto-complete the order status.
*/
@sarangs07
sarangs07 / functions.php
Created March 6, 2020 04:35
Change the Billing Details text
/*
* Code installation instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
/* Change the Billing Details text */
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
@sarangs07
sarangs07 / functions.php
Last active March 9, 2020 09:40
Filter to hide/show Coupons on CartFlows page
/*
* Code installation instructions:
* 1. Copy the below code.
* 2. Open your child theme's functions.php file.
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting.
*/
/* Filter to hide/show on CartFlows page */
add_filter( 'cartflows_show_coupon_field', 'br_hide_coupon_field' );