Skip to content

Instantly share code, notes, and snippets.

View varun-pluginhive's full-sized avatar

varun-pluginhive

View GitHub Profile
@varun-pluginhive
varun-pluginhive / functions.php
Last active December 3, 2018 09:38
Snippet to change ShipTimeStamp based on Current Time in FedEx Rate Request. WooCommerce FedEx Shipping Plugin with Print Label - https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
/**
* Snippet to change ShipTimeStamp based on Current Time in FedEx Rate Request.
* Created at : 03 Dec 2018
* Updated at : 03 Dec 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/95a643f265b2ea2dfd84fd7194c79394
*/
add_filter( 'xa_fedex_rate_request', function( $request ) {
$current_wp_time = date_create(current_time('c',false));
@varun-pluginhive
varun-pluginhive / functions.php
Created December 1, 2018 08:45
Snippet to support CodeCanyon WooCommerce Currency Switcher. Note - In Plugin Settings Currency should be set to the fedex account country. No need of Conversion rate. WooCommerce FedEx Shipping Plugin with Print Label - https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
/**
* Snippet to support CodeCanyon WooCommerce Currency Switcher. Note - In Plugin Settings Currency should be set to the fedex account country. No need of Conversion rate.
* Created at : 01 Dec 2018
* Updated at : 01 Dec 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/314791bd8f864075e43b857feb1e0c72
*/
// Rate Request
add_filter( 'xa_fedex_rate_request', function( $request ){
@varun-pluginhive
varun-pluginhive / custom_code.php
Last active November 30, 2018 10:57
Template to attach shipment tracking number in WooCommerce Email Customizer with Drag and Drop Email Builder. WooCommerce FedEx Shipping Plugin with Print Label - https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
<?php
/**
* Custom code shortcode
*
* This template can be overridden by copying it to yourtheme/woocommerce_email_cuztomizer_with_drag_and_drop_builder/woo_mail/custom_code.php.
* @var $order WooCommerce order
* @var $email_id WooCommerce email id (new_order, cancelled_order)
* @var $sent_to_admin WooCommerce email send to admin
* @var $plain_text WooCommerce email format
* @var $email WooCommerce email object
@varun-pluginhive
varun-pluginhive / functions.php
Last active November 16, 2018 05:29
Snippet to change Destination Country in UPS confirm request. WooCommerce UPS Shipping Plugin with Print Label - https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/
/**
* Snippet to change Destination Country in UPS confirm request.
* Created at : 16 Nov 2018
* Updated at : 16 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/3b56ce74f7dcd9af9282a6e7c7484fa7
*/
add_filter( 'wf_ups_shipment_confirm_request_data', function( $request ){
$request['Shipment']['ShipTo']['Address']['CountryCode'] = 'US';
return $request;
@varun-pluginhive
varun-pluginhive / functions.php
Created November 13, 2018 09:15
Snippet to provide minimum package weight in FedEx Rate Request. WooCommerce FedEx Shipping Plugin with Print Label - https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
/**
* Snippet to provide minimum package weight in FedEx Rate Request.
* Created at : 13 Nov 2018
* Updated at : 13 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/42b90d1a70c8f85128b417ee5ebb99bf
*/
add_filter( 'xa_fedex_rate_request', function($request){
$packaging_types = array( 'FEDEX_ENVELOPE' ); // Packaging Type
@varun-pluginhive
varun-pluginhive / functions.php
Last active November 13, 2018 07:26
Snippet to display error message on woocommerce checkout depending on Specified criteria. PluginHive Plugins : https://www.pluginhive.com/plugins/
/**
* Snippet to change display error message on checkout depending on Specified criteria.
* Created at : 10 Nov 2018
* Updated at : 13 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/930abedc8acf3718a6ac8aceb07a503d
*/
add_action( 'woocommerce_checkout_process', function(){
@varun-pluginhive
varun-pluginhive / functions.php
Created November 10, 2018 09:43
Snippet to get selected shipping method while checkout. Note - It won't work from backend. Estimated Delivery Date Plugin For WooCommerce - https://www.pluginhive.com/product/estimated-delivery-date-plugin-woocommerce/
/**
* Snippet to get selected shipping method while checkout. Note - It won't work from backend estimated delivery calculation.
* Created at : 10 Nov 2018
* Updated at : 10 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/817af6c946c4c8ff15b844ca31e7023f
*/
add_filter( 'ph_estimated_delivery_selected_shipping_method_on_order', function( $shipping_method ){
if( ! empty($_POST['shipping_method']) ) {
@varun-pluginhive
varun-pluginhive / functions.php
Last active November 9, 2018 14:18
Snippet to adjust WooCommerce Shipping Rates to shipping method by specified amount of percent. PluginHive Plugins : https://www.pluginhive.com/plugins/
/**
* Snippet to adjust WooCommerce Shipping Rates to shipping method by specified amount of percent.
* Created at : 09 Nov 2018
* Updated at : 09 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/ddba44d01e406891540263eb9264dd0d
*/
add_filter( 'woocommerce_package_rates', function( $package_rates ){
$cost_adjustment = 15; // Cost adjustment in percent
@varun-pluginhive
varun-pluginhive / functions.php
Created November 8, 2018 09:18
Snippet to get order id from order number. WooCommerce Shipment Tracking Pro - https://www.pluginhive.com/product/woocommerce-shipment-tracking-pro/
/**
* Snippet to get order id from order number.
* Created at : 08 Nov 2018
* Updated at : 08 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/1def2866db5d1621ad46ea1c2422c1df
*/
if( ! class_exists('Ph_Shipment_Tracking_Order_Number_Comp') ){
class Ph_Shipment_Tracking_Order_Number_Comp{
@varun-pluginhive
varun-pluginhive / functions.php
Created November 8, 2018 05:58
Snippet to change Label size(LabelStockType) in FedEx create shipment request. WooCommerce FedEx Shipping Plugin with Print Label - https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
/**
* Snippet to change Label size(LabelStockType) in fedex create shipment request.
* Created at : 08 Nov 2018
* Updated at : 08 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/4ca11475002212e4f6930c0c6ca83d44
*/
add_filter( 'wf_fedex_request', function( $request ){
// Fedex Services for which the label size need to be changed