Skip to content

Instantly share code, notes, and snippets.

View zorem's full-sized avatar

zorem zorem

View GitHub Profile
@zorem
zorem / remove_tracking_info_invoice_pdf.php
Created July 23, 2019 11:35
Do not show information of the plugin “Shipment Tracking” in invoice PDFs
<?php
// Add this code to your theme functions.php file or a custom plugin
if ( class_exists( 'zorem_woocommerce_advanced_shipment_tracking' ) ) {
add_action( 'wp_wc_invoice_pdf_start_template', function() {
$tracking_actions = $GLOBALS[ 'WC_advanced_Shipment_Tracking' ];
remove_action( 'woocommerce_email_before_order_table', array( $tracking_actions, 'email_display' ), 0, 4 );
});
add_action( 'wp_wc_invoice_pdf_end_template', function() {
$tracking_actions = $GLOBALS[ 'WC_advanced_Shipment_Tracking' ];
@zorem
zorem / login-redirect.php
Created August 5, 2019 09:21
Using this code snippet you can redirect to custom page after login
<?php
add_filter( "wcalr_login_redirect", "wcalr_login_redirect_link", 10, 1);
function wcalr_login_redirect_link($link){
$link = get_home_url();
return $link;
}
@zorem
zorem / register-redirect.php
Created August 5, 2019 09:25
Using this code snippet you can redirect to custom page after register
<?php
add_filter( "wcalr_register_redirect", "wcalr_register_redirect_link", 10, 1);
function wcalr_register_redirect_link($link){
$link = get_home_url();
return $link;
}
@zorem
zorem / after-login-registration.php
Created August 5, 2019 09:31
Just use below snippet by using this snippet you can maintaining login status after successful login. You just need to add this snippet code in a function.php file if you want to maintain login status.
add_action( "wcalr_after_login", 'wcalr_after_login_func', 10, 1 );
function wcalr_after_login_func($user_signon){
wp_set_current_user($user_signon->ID);
wp_set_auth_cookie($user_signon->ID);
}
@zorem
zorem / .htaccess
Created August 12, 2019 13:58
This means in your store there HTTP request is blocked, this is because of server configuration. You'll need to edit your .htaccess file by adding the following code above # BEGIN WordPress :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
</IfModule>
@zorem
zorem / create_partial_shipped_status.php
Created October 25, 2019 06:03
From this code snippet you can create custom order status partial shipped
<?php
// Add this code to your theme functions.php file or a custom plugin
add_action('init', 'register_partial_shipped_order_status');
//add status after completed
add_filter('wc_order_statuses', 'add_partial_shipped_to_order_statuses');
//Custom Statuses in admin reports
add_filter('woocommerce_reports_order_statuses', 'include_partial_shipped_order_status_to_reports', 20, 1);
// for automate woo to check order is paid
add_filter('woocommerce_order_is_paid_statuses', 'partial_shipped_woocommerce_order_is_paid_statuses');
/*** Register new status : Delivered
@zorem
zorem / functions.php
Last active December 27, 2019 12:34
Code for update tracking page text
<?php
// Filter for change description before tracking form
// Default text - To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.
add_filter( 'ast_tracking_page_front_text', 'ast_tracking_page_front_text_fun' );
function ast_tracking_page_front_text_fun($string){
$string = 'Updated Text';
return $string;
}
// Filter for change text of order label in form
@zorem
zorem / redirect-404-error-page.php
Last active May 13, 2020 10:59
How To Change Redirect The 404 Error Page
/**
* redirect 404 error page.
*/
function redirect_404_to_otherpage($url){
return $url = get_permalink('page id');
}
add_filter( 'cbr_redirect_page_dir', 'redirect_404_to_otherpage', 10, 1 );
@zorem
zorem / woocommerce_payment_complete_order_status.php
Created May 13, 2020 13:04
The function is for change order status to competed if order is virtual and downloadable
<?php
add_filter( 'woocommerce_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 4 );
/*
* move processing to completed
*/
function virtual_order_payment_complete_order_status( $order_status, $order_id ) {
$order = wc_get_order( $order_id );
if ( 'processing' == $order_status ) {
$virtual_order = null;
@zorem
zorem / functions.php
Last active June 23, 2020 05:24
Code for change tracking provider name in email, my account section and trackship tracking page
<?php
add_filter( 'ast_provider_title', 'ast_provider_title_fun' );
function ast_provider_title_fun($provider){
if($provider == 'UPS')$provider = 'Updated UPS';
return $provider;
}
?>