Skip to content

Instantly share code, notes, and snippets.

View vanbo's full-sized avatar

Ivan Andreev vanbo

View GitHub Profile
@vanbo
vanbo / wc-css-make-storefront-product-tabs-horizontal
Created October 27, 2017 11:33
WooCommerce: CSS to make Storefront product tabs horizontal again
.product .woocommerce-tabs ul.tabs {
width: 100%;
float: none;
margin-right: 5.8823529412%;
}
.woocommerce div.product .woocommerce-tabs ul.tabs {
list-style: none;
padding: 0 0 0 1em;
margin: 0 0 1.618em;
@vanbo
vanbo / wc-epaybg-change-request-description.php
Created September 18, 2023 19:53
wc-epaybg-change-request-description
add_filter( 'wc_epaybg_request_parameters', 'vanbodevelops_epaybg_add_order_number_to_description', 10, 4 );
/**
* @param $epaybg_args
* @param $payment_type
* @param $order
* @param \WC_Gateway_Epaybg $gateway
*
* @return array
*/
function vanbodevelops_epaybg_add_order_number_to_description( $epaybg_args, $payment_type, $order, $gateway ) {
@vanbo
vanbo / pay360-register-all-users
Created August 16, 2023 12:36
pay360-register-all-users
/**
* NOTE: Add to 'wp-content/themes/your-theme/functions.php' file
*/
add_filter( 'pay360_hosted_cashier_get_parameters', 'vanbodevelops_pay360_always_register_account', 10, 3 );
function vanbodevelops_pay360_always_register_account( $args, $order, $gateway ) {
if ( 0 < $order->get_customer_id() ) {
return $args;
}
$customer_id = $order->get_meta( 'wc_pay360_guest_customer_id', true );
@vanbo
vanbo / remove-bank-details-from-order-email.php
Last active June 3, 2023 18:11
Remove bank details from WC order email. Place in functions.php
// Add your own action for the bank instructions
add_action( 'woocommerce_email_before_order_table', 'prefix_email_instructions', 9, 3 );
function prefix_email_instructions( $order, $sent_to_admin, $plain_text = false ) {
// Get the gateway object
$gateways = WC_Payment_Gateways::instance();
$available_gateways = $gateways->get_available_payment_gateways();
$gateway = isset( $available_gateways['bacs'] ) ? $available_gateways['bacs'] : false;
// We won't do anything if the gateway is not available
if ( false == $gateway ) {
@vanbo
vanbo / paytrace-protect-js-theme.php
Created March 10, 2023 15:23
paytrace-protect-js-theme
add_filter( 'wc_paytrace_protect_form_theme', 'vanbo_paytrace_protect_js_theme', 10, 3 );
function vanbo_paytrace_protect_js_theme( $theme_styles, $map, $id ) {
return array(
'iframe' => array(
'background' => '',
'padding' => '',
'margin' => '',
),
'code' => array(
'font_color' => '#6d6d6d',
@vanbo
vanbo / paysafe-filter-request-params.php
Last active January 20, 2023 12:20
paysafe-filter-request-params
add_filter( 'wc_paysafe_token_transaction_parameters', 'vanbo_paysafe_token_request_params', 10, 4 );
/**
* @param array $params
* @param \WC_Order $order
* @param $token
* @param string $type Possible values: interac, cards, directdebit
*
* @return array
*/
function vanbo_paysafe_token_request_params( $params, $order, $token, $type ) {
@vanbo
vanbo / wc-add-order-notes-to-admin-emails
Last active November 14, 2022 13:02
WooCommerce: Add Order notes to admin emails
add_action( 'woocommerce_email_order_meta', 'woo_add_order_notes_to_email', 10, 3 );
function woo_add_order_notes_to_email( $order, $sent_to_admin = true, $plain_text = false ) {
// You want to send those only to the Admin
if ( ! $sent_to_admin ) {
return;
}
// You can also check which email you are sending, by checking the order status
// Optional, comment it out, if not needed
@vanbo
vanbo / wc-epaybg-no-pay-page-reload-after-form-submit
Last active September 12, 2022 13:11
WooCommerce ePaybg: Do not allow Pay page reload after customer is sent to ePaybg
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;
}
@vanbo
vanbo / paytrace-add-card-details-to-order.php
Created June 8, 2022 14:59
paytrace-add-card-details-to-order.php
/**
* NOTE: Add to 'wp-content/themes/your-theme/functions.php' file
*/
add_action( 'wc_paytrace_transaction_approved_response_processed', 'vanbodevelops_add_order_details', 10, 2 );
/**
* @param \WcPaytrace\Abstracts\Response $response
* @param \WC_Order $order
*/
function vanbodevelops_add_order_details( $response, $order ) {
try {
@vanbo
vanbo / wc-filter-cart-contents-weight
Created October 24, 2017 09:51
Filter WooCommerce Cart Contents Weight
add_filter( 'woocommerce_cart_contents_weight', 'prefix_filter_cart_contents_weight' );
function prefix_filter_cart_contents_weight( $weight ) {
/**
* Adding 170 units to the total cart weight.
*/
return $weight + 170;
}