Skip to content

Instantly share code, notes, and snippets.

@wpweb101
wpweb101 / woo_pr_enable_signup_earn_email_notification.php
Created May 8, 2020 08:19
Woo points and rewards snippet for disable email notificaiton for signup earn points
<?php
function woo_pr_disable_signup_earn_email_notification( $is_email_enable ){
$is_email_enable = false;
return $is_email_enable;
}
add_filter('woo_pr_enable_signup_earn_email_notification', 'woo_pr_disable_signup_earn_email_notification',10,1);
@wpweb101
wpweb101 / woo_pr_disable_vender_notification_email.php
Created April 7, 2020 09:23
WooCommerce Points and Rewards - code to stop receiving email for the vendor
<?php
// add this code inside the functions.php file of your child theme
function woo_pr_disable_vender_notification_email($enable){
$enable = false; // will not send the notification email to the venodr
return $enable;
}
add_filter( 'woo_pr_disable_vender_notification_email', 'woo_pr_disable_vender_notification_email',10,1);
@wpweb101
wpweb101 / woo_vou_pdf_is_voucher_vendor_role.php
Created March 4, 2020 11:47
WooCommerce Pdf Vouchers - code to identify current login user role is voucher vendor
<?php
global $current_user, $woo_vou_vendor_role;
//Current user role
$user_roles = isset( $current_user->roles ) ? $current_user->roles : array();
$user_role = array_shift( $user_roles );
if( in_array( $user_role, $woo_vou_vendor_role ) ) { // Check current user is voucher vendor role
// perform your action
}
@wpweb101
wpweb101 / woo_vou_pdf_coupon_hold_stock_on_checkout.php
Created March 3, 2020 07:02
WooCommerce Pdf Vouchers - Function to solves coupon code already used issue on checkout page
// add below code to the functions.php of your child theme.
add_filter('woocommerce_hold_stock_for_checkout', 'woo_vou_pdf_coupon_hold_stock_on_checkout');
/**
* Disable the filter
*/
function woo_vou_pdf_coupon_hold_stock_on_checkout(){
return false;
}
@wpweb101
wpweb101 / woo_coll_remove_button_from_cart.php
Created February 12, 2020 12:00
Code to remove Add to collection from single product page
<?php
// put this code inside functions.php file inside your child theme
global $woo_cl_public;
remove_action( 'woocommerce_after_add_to_cart_button', array( $woo_cl_public, 'woo_cl_add_to_collection_button' ) );
@wpweb101
wpweb101 / woo_vou_pdf_change_download_text_on_list.php
Created January 21, 2020 10:10
WooCommerce Pdf Vouchers - Function to change download button text on my account downloads listing page
<?php
add_filter('woocommerce_customer_get_downloadable_products','woo_vou_pdf_change_download_text_on_list');
function woo_vou_pdf_change_download_text_on_list( $downloads ){
if( !empty( $downloads ) ){
$vou_download_text = get_option( 'vou_download_text' );
$vou_download_text = !empty($vou_download_text) ? $vou_download_text : esc_html__( 'Voucher Download', 'woovoucher' );
foreach ( $downloads as $key => $download) {
@wpweb101
wpweb101 / woo_vou_pdf_change_booking_date_shortcodes.php
Created September 6, 2019 11:43
WooCommerce Pdf Vouchers - Function to change {booking_date} shortcode date format
<?php
add_filter( 'woo_vou_pdf_template_replace_shortcodes', 'woo_vou_pdf_change_booking_date_shortcodes', 999, 6 );
function woo_vou_pdf_change_booking_date_shortcodes( $woo_vou_details, $orderid, $item_key, $items, $voucodes, $productid ){
// code to change booking date shortcode date format on voucher pdf
if( isset( $woo_vou_details['booking_date'] ) && !empty( $woo_vou_details['booking_date'] ) ){
$woo_vou_details['booking_date'] = date( 'Y-M-D', strtotime( $woo_vou_details['booking_date'] ) );
}
return $woo_vou_details;
}
@wpweb101
wpweb101 / woo-vou-add-extra-productinfo.php
Created August 1, 2019 14:25
Woocommerce PDF Vouchers - Display extra information after product information to check voucher code page
<?php
// Code to display product quantity and product total after product information
add_action('woo_vou_after_productinfo', 'woo_vou_add_extra_product_info', 10, 3 );
function woo_vou_add_extra_product_info( $voucodeid, $item_id, $order_id ){
//get order
$order = wc_get_order( $order_id );
//get order items
@wpweb101
wpweb101 / woo_vou_hide_voucher_info_fields.php
Last active August 1, 2019 10:24
WooCommerce Pdf Voucher - hide buyer's information while using shortcode [woo_vou_check_code]
<?php
/**
* Handles to hide product information from check voucher code page for frontend
*/
add_filter('woo_vou_check_vou_productinfo_fields', 'woo_vou_hide_product_info_fields');
function woo_vou_hide_product_info_fields( $product_info_columns ){
if( woo_vou_check_is_frontend_ajax() ){
if( isset( $product_info_columns['redeemable_price'] )){
@wpweb101
wpweb101 / woo_vou_pdf_custom_order_meta.php
Last active February 19, 2019 09:11
WooCommerce Pdf Voucher - Display order meta without label
<?php
/**
* Adding order meta value to the Custom shortcode in PDF voucher
*/
function woo_vou_pdf_order_items_meta_shortcodes( $voucher_template_html, $orderid, $item_key, $items, $voucodes, $productid) {
$hidden_order_itemmeta = apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',