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
//added phive_booking condition also, so that credits can be calculated according to the number of recurrences and the number of persons if "Consider each participant as separate booking" is checked. | |
public static function get_credit_from_cart_item($item, $single = true, $composite = false) | |
{ | |
$total_credits_amount = 0; | |
$prod_id = wdcp_get_product_id_cart_item($item); | |
$prod_id = wdcp_icl_object_id($prod_id); | |
$product = $item['data']; | |
if (!$product->is_type('credits')) |
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
// to display correct credit amount for line total and subtotal after order is placed. In case of person as booking, the credits should be multiplied with number of participants. | |
add_filter('woocommerce_order_subtotal_to_display', 'order_subtotal_to_display_with_credits', 11, 3); | |
add_filter('woocommerce_order_formatted_line_subtotal', 'order_formatted_line_subtotal_with_credits', 11, 3); | |
function order_subtotal_to_display_with_credits($subtotal, $compound, $order) | |
{ | |
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id(); | |
$credits_total = 0; | |
$payment_method = get_post_meta($order_id, '_payment_method', true); |
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_filter('woocommerce_csv_product_post_columns','woocommerce_csv_product_post_columns',1); | |
function woocommerce_csv_product_post_columns($default_post_columns=array()){ | |
$default_post_columns['_yith_wcpb_bundle_data'] = 'meta:_yith_wcpb_bundle_data'; | |
return $default_post_columns; | |
} | |
add_filter('hf_woocommerce_csv_product_import_allowed_product_types', 'hf_woocommerce_csv_product_import_allowed_product_types', 1); |
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
/** | |
* Snippet to change UPS account details in rate request when Access Point address has been selected. | |
* Created at : 27 Aug 2018 | |
* Updated at : 27 Aug 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/xadapter/8891ba54b0cd2a642813e83e1d7e9810 | |
*/ | |
if( ! function_exists('ph_change_ups_account_for_accesspoint_rate_request') ) { | |
function ph_change_ups_account_for_accesspoint_rate_request( $xml_request, $package ){ |
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
/** | |
* Snippet to change Estimated Delivery date style on cart page. | |
* Created at : 24 Aug 2018 | |
* Updated at : 24 Aug 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/xadapter/23dc533d6e166b76fa25d0c8d4fd0f5b | |
*/ | |
add_filter( 'xa_estimated_delivery_cart_checkout_page_html_formatted_date', function($date) { | |
$date = str_replace( '<td', '<td style="font-weight: bold;"', $date); |
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
/** | |
* Snippet to change UPS credentials in UPS Accesspoint Locator Request. Requires UPS plugin version - 3.10.2. | |
* Created at : 22 Aug 2018 | |
* Updated at : 22 Aug 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/xadapter/cb7a9a83b11d953077c57e4bcc8fa072 | |
*/ | |
if( ! function_exists('ph_change_ups_accesspoint_credentials') ){ | |
function ph_change_ups_accesspoint_credentials( $xml_request, $ups_settings ) { |
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_filter('hf_insert_post_extra_data', 'hf_import_alter_product_csv_row_data', 100, 3); | |
add_action('hf_alter_product_export_csv_columns', 'hf_alter_product_csv_columns_head', 100); | |
add_action('hf_alter_product_export_csv_data', 'hf_alter_product_csv_row_data', 100, 2); | |
/** | |
Product bundle export/import code snippet - with SKU | |
@global type $wpdb | |
@param type $additional_columns | |
@return array |
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
/** | |
* Snippet to change weight in Woocommerce Canada Post Rate Request. | |
* Created at : 10 Aug 2018 | |
* Updated at : 10 Aug 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/xadapter/f6c84df50af11b5f952e170379933f7f | |
*/ | |
add_filter( 'xa_canadapost_rate_request', function( $request ){ | |
$default_weight = 15; // In kg |
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
/** | |
* Snippet to hide duplicate shipping rates (Name and Cost both should match). | |
* Created at : 09 Aug 2018 | |
* Updated at : 09 Aug 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/xadapter/71473722eb88105bf70d6d5d0932aed1 | |
*/ | |
add_filter( 'woocommerce_package_rates', function( $shipping_rates ){ | |
$hide_duplicate_rules = array('wf_multi_carrier_shipping'); // Hide Duplicate Rates for these shipping methods |
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
/** | |
* Snippet to add handling charge to WooCommerce Shipping Methods based on Shipping Class. | |
* Created at : 06 Aug 2018 | |
* Updated at : 06 Aug 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/xadapter/288aff384db2a04fb3b96ec53239dbc0 | |
*/ | |
add_filter( 'woocommerce_package_rates', 'ph_add_extra_cost_based_on_shipping_class', 10, 2); | |
if( ! function_exists('ph_add_extra_cost_based_on_shipping_class') ) { |
NewerOlder