This file contains hidden or 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
| /** | |
| * Cancel all failed orders after held duration | |
| * The method is adapted from the WooCommerce "wc_cancel_unpaid_orders" function and uses 'woocommerce_cancel_unpaid_orders' schedule hook | |
| * | |
| * Code location: Add the code to your "child-theme/functions.php" file | |
| * | |
| * Requirements: "Product > Inventory > Manage Stock" enabled, and time set in the "Product > Inventory > Hold stock (minutes)" setting. | |
| */ | |
| function vanbo_cancel_failed_orders() { | |
| $held_duration = get_option( 'woocommerce_hold_stock_minutes' ); |
This file contains hidden or 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
| /** | |
| * NOTE: Add the code to your "child-theme/functions.php" file | |
| */ | |
| add_filter( 'wc_borica_form_request_parameters', 'vanbodevelops_filter_borica_request', 10, 3 ); | |
| function vanbodevelops_filter_borica_request( $params, $order, $gateway ) { | |
| // NOTE: Use each block as needed. | |
| // 1. Change the Borica payment page language | |
| // 'BG' - bulgarian, 'EN' - english | |
| $params['language'] = 'EN'; |
This file contains hidden or 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
| /** | |
| * IMPORTANT: Add the code to your "child-theme/functions.php" file | |
| */ | |
| add_filter( 'wc_trustcommerce_process_single_payment_request', 'vanbo_tc_add_operator_to_requests', 10 ); | |
| add_filter( 'wc_trustcommerce_process_profile_payment_request_request', 'vanbo_tc_add_operator_to_requests', 10 ); | |
| add_filter( 'wc_trustcommerce_create_customer_profile_request', 'vanbo_tc_add_operator_to_requests', 10 ); | |
| add_filter( 'wc_trustcommerce_update_customer_profile_request', 'vanbo_tc_add_operator_to_requests', 10 ); | |
| add_filter( 'wc_refund_payment_request_trustcommerce', 'vanbo_tc_add_operator_to_requests', 10 ); | |
| add_filter( 'wc_capture_payment_request_trustcommerce', 'vanbo_tc_add_operator_to_requests', 10 ); |
This file contains hidden or 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
| /** | |
| * IMPORTANT: Past this snippet to your "child-theme\functions.php" file. | |
| */ | |
| add_action( 'init', 'vanbo_store_polylang_language', 99 ); | |
| /** | |
| * Saves the Polylang last used language by the current user | |
| */ | |
| function vanbo_store_polylang_language() { | |
| if ( ! function_exists( 'WC' ) || ! WC()->session ) { |
This file contains hidden or 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_action( 'woocommerce_receipt_epaybg', 'vanbo_initiate_epaybg_request_hooks', 9 ); | |
| /** | |
| * Replaces the gateway original action with our own | |
| */ | |
| function vanbo_initiate_epaybg_request_hooks() { | |
| $gateway = vanbo_get_epaybg_gateway(); | |
| if ( false == $gateway ) { | |
| return; | |
| } |
This file contains hidden or 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
| /** | |
| * NOTE: Add this snippet to your "child-theme\functions.php" file | |
| */ | |
| add_action( 'wp_footer', 'vanbo_add_block_script_to_footer', 9999 ); | |
| function vanbo_add_block_script_to_footer() { | |
| ?> | |
| <script> | |
| (function ($) { | |
| /** |
This file contains hidden or 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 to your "themes/child-theme-folder/functions.php" file | |
| */ | |
| add_filter( 'wc_psigate_process_credit_card_payment_parameters', 'vanbo_combine_shipping_in_total', 10, 2 ); | |
| function vanbo_combine_shipping_in_total( $parameters, $order ) { | |
| $total = number_format( ( $order->get_total() - WC_Compat_PsiGate::get_total_shipping( $order ) - $order->get_total_tax() ), 2, '.', '' ); | |
| // If the total is 0 | |
| if ( 0 >= $total ) { | |
| // Subtotal will equal the order total |
This file contains hidden or 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
| /** | |
| * NOTЕ: Add the code to your "themes\child-theme\functions.php" file | |
| */ | |
| add_filter( 'pay360_hosted_cashier_get_parameters', 'vanbodevelops_do_not_register_profile', 10, 3 ); | |
| function vanbodevelops_do_not_register_profile( $args, $order, $get_gateway ) { | |
| // Send the 'registered' parameter as false, | |
| // so Pay360 will not create a profile for the customer in their system. | |
| if ( ! empty( $args['customer'] ) ) { | |
| $args['customer']['registered'] = false; | |
| } |
This file contains hidden or 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
| /** | |
| * IMPORTANT: Place the snippet inside your "wp-content\themes\child-theme\functions.php" file | |
| */ | |
| /** | |
| * Replace the Pay360 image in the checkout icon | |
| */ | |
| add_filter( 'woocommerce_pay360_icon', 'vanbodevelops_pay360_icon', 10 ); | |
| function vanbodevelops_pay360_icon( $image ) { | |
| return WC_Pay360::plugin_url() . '/pay360-logo.png'; |
This file contains hidden or 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 to "wp-content\themes\child-theme\functions.php" file | |
| */ | |
| add_filter( 'wc_psigate_process_acc_manager_payment_parameters', 'vanbodevelops_filter_acc_parameters', 10, 2 ); | |
| add_filter( 'wc_psigate_process_credit_card_payment_parameters', 'vanbodevelops_filter_acc_parameters', 10, 2 ); | |
| function vanbodevelops_filter_acc_parameters( $parameters, $order ) { | |
| $transaction_count = get_incremented_transaction_attempt( $order ); | |
| // Check if the order is paid and which attempt of transaction it is | |