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 | |
add_filter( 'woocommerce_package_rates', 'override_ups_rates' ); | |
function override_ups_rates( $rates ) { | |
foreach( $rates as $rate_key => $rate ){ | |
// Check if the shipping method ID is UPS | |
if( ($rate->method_id == 'flexible_shipping_ups') ) { | |
// Set cost to zero | |
$rates[$rate_key]->cost = 0; | |
} | |
} |
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 | |
/* Disable autofocus on the billing First Name field */ | |
add_filter('woocommerce_billing_fields','disable_autofocus_billing_firstname'); | |
function disable_autofocus_billing_firstname($fields) { | |
$fields['billing_first_name']['autofocus'] = false; | |
return $fields; | |
} | |
/* Disable autofocus on the shipping First Name field */ | |
add_filter('woocommerce_shipping_fields','disable_autofocus_shipping_firstname'); |
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 | |
public function musicetrade_set_price($price, $product) { | |
global $product; | |
$product_id = $product->get_id(); | |
$seller_currency = self::get_pv_shop_currency(self::get_product_vendor_id($product_id),self::shop_base_currency()); | |
$active_currency = get_woocommerce_currency(); | |
if( $active_currency != $seller_currency ) { | |
//if active currency and vendor's currency are different, do the conversion | |
$etrade_price = round(self::convert($price, $active_currency, $seller_currency)); |
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 | |
//Start Date - Set default to todays date | |
update_post_meta( $post_id, '_auction_dates_from', stripslashes( date('Y-m-d H:i') ) ); | |
//End Date - conditional | |
if (isset($_POST['_auction_duration'])): | |
$aucdur = $_POST['_auction_duration'] + 1; | |
$duration = "+".$aucdur." day"; | |
update_post_meta( $post_id, '_auction_dates_to', stripslashes( date('Y-m-d H:i', strtotime($duration)) ) ); | |
endif; |
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 | |
// Auction Duration | |
WCVendors_Pro_Form_Helper::select( apply_filters( 'wcv_simple_auctions_auction_duration', array( | |
'post_id' => $post_id, | |
'id' => '_auction_duration', | |
'label' => __( '<i class="fa fa-calendar"></i> Duration', 'wc_simple_auctions' ), | |
'class' => 'form-control', | |
'desc_tip' => 'true', | |
'description' => sprintf( __( 'Select how long your listing will run.', 'wcvendors-pro-simple-auctions' ) ), | |
'wrapper_start' => '<div id="duration-box" class="column large-6">', |
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 | |
//Aftership Automatic Tracker | |
add_action('wp_head','trackship_catcher'); | |
function trackship_catcher() { | |
if(isset($_GET['webhook-listener']) && $_GET['webhook-listener'] == 'trackship') { | |
//Get and decode JSON | |
$str = file_get_contents("php://input"); | |
$json = json_decode($str, true); | |